/* 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__display__render
#define __PYX_HAVE_API__renpy__display__render
#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[] = {
  "render.pyx",
  "render.pxd",
  "stringsource",
};

/*--- Type declarations ---*/
struct __pyx_obj_5renpy_7display_6render_Matrix2D;
struct __pyx_obj_5renpy_7display_6render_Render;
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":71
 *     cdef public bint text_input
 * 
 *     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":72
 * 
 *     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":73
 *     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/render.pxd":22
 * # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 * cdef class Matrix2D:             # <<<<<<<<<<<<<<
 *     cdef public double xdx
 *     cdef public double xdy
 */
struct __pyx_obj_5renpy_7display_6render_Matrix2D {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *__pyx_vtab;
  double xdx;
  double xdy;
  double ydx;
  double ydy;
};


/* "renpy/display/render.pxd":31
 *     cpdef bint is_unit_aligned(Matrix2D self)
 * 
 * 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_6render_Matrix2D *forward;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *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;
};



/* "renpy/display/render.pyx":354
 * 
 * 
 * cdef class Matrix2D:             # <<<<<<<<<<<<<<
 *     """
 *     This represents a 2d matrix that can be used to transform
 */

struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D {
  PyObject *(*transform)(struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, int __pyx_skip_dispatch);
  int (*is_unit_aligned)(struct __pyx_obj_5renpy_7display_6render_Matrix2D *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *__pyx_vtabptr_5renpy_7display_6render_Matrix2D;


/* "renpy/display/render.pyx":575
 * PIXELLATE = 3
 * 
 * cdef class Render:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(Render self, float width, float height, draw_func=None, layer_name=None, bint opaque=False): #@DuplicatedSignature
 */

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;

/* --- 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);

/* 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);

/* 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);

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

/* 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

/* 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

/* 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

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

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

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

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

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

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

/* UnpackTupleError.proto */
static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);

/* UnpackTuple2.proto */
#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
    (likely(is_tuple || PyTuple_Check(tuple)) ?\
        (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
            __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
            (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
        __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
    PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
static int __Pyx_unpack_tuple2_generic(
    PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);

/* dict_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_is_dict);
static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
                                              PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);

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

/* 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

/* 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

/* 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

/* 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);

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

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

/* 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

/* SwapException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

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

/* 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

/* 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);

/* 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));
}

/* 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);

/* WriteUnraisableException.proto */
static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback, int nogil);

/* 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

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

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

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* SliceObject.proto */
#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
    __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
        PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* 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

/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* PyIntFromDouble.proto */
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value);
#else
#define __Pyx_PyInt_FromDouble(value) PyLong_FromDouble(value)
#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

/* 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 *);

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

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

/* GetNameInClass.proto */
static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name);

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

/* 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);

/* 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);

/* 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);

/* FunctionExport.proto */
static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);

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

static PyObject *__pyx_f_5renpy_7display_6render_8Matrix2D_transform(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_5renpy_7display_6render_8Matrix2D_is_unit_aligned(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, int __pyx_skip_dispatch); /* proto*/
static int __pyx_f_5renpy_7display_6render_6Render_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_blit *__pyx_optional_args); /* proto*/
static int __pyx_f_5renpy_7display_6render_6Render_subpixel_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit *__pyx_optional_args); /* proto*/
static int __pyx_f_5renpy_7display_6render_6Render_absolute_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_absolute_blit *__pyx_optional_args); /* proto*/

/* Module declarations from 'renpy.display.render' */
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Matrix2D = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Render = 0;
static PyObject *__pyx_v_5renpy_7display_6render_live_renders = 0;
static double __pyx_v_5renpy_7display_6render_frame_time;
static int __pyx_v_5renpy_7display_6render_rendering;
static int __pyx_v_5renpy_7display_6render_render_is_ready;
static PyObject *__pyx_f_5renpy_7display_6render_render(PyObject *, PyObject *, PyObject *, double, double, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_5renpy_7display_6render___pyx_unpickle_Matrix2D__set_state(struct __pyx_obj_5renpy_7display_6render_Matrix2D *, PyObject *); /*proto*/
static PyObject *__pyx_f_5renpy_7display_6render___pyx_unpickle_Render__set_state(struct __pyx_obj_5renpy_7display_6render_Render *, PyObject *); /*proto*/
#define __Pyx_MODULE_NAME "renpy.display.render"
extern int __pyx_module_is_main_renpy__display__render;
int __pyx_module_is_main_renpy__display__render = 0;

/* Implementation of 'renpy.display.render' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_NotImplemented;
static const char __pyx_k_d[] = "d";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_j[] = "j";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_t[] = "t";
static const char __pyx_k_v[] = "v";
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_at[] = "at";
static const char __pyx_k_cf[] = "cf";
static const char __pyx_k_cw[] = "cw";
static const char __pyx_k_gc[] = "gc";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_mx[] = "mx";
static const char __pyx_k_my[] = "my";
static const char __pyx_k_rv[] = "rv";
static const char __pyx_k_st[] = "st";
static const char __pyx_k_sw[] = "sw";
static const char __pyx_k_sx[] = "sx";
static const char __pyx_k_sy[] = "sy";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_arc[] = "arc";
static const char __pyx_k_arg[] = "arg";
static const char __pyx_k_cx0[] = "cx0";
static const char __pyx_k_cx1[] = "cx1";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_now[] = "now";
static const char __pyx_k_pos[] = "pos";
static const char __pyx_k_sx0[] = "sx0";
static const char __pyx_k_sx1[] = "sx1";
static const char __pyx_k_xdx[] = "xdx";
static const char __pyx_k_xdy[] = "xdy";
static const char __pyx_k_ydx[] = "ydx";
static const char __pyx_k_ydy[] = "ydy";
static const char __pyx_k_BLIT[] = "BLIT";
static const char __pyx_k_blit[] = "blit";
static const char __pyx_k_ceil[] = "ceil";
static const char __pyx_k_core[] = "core";
static const char __pyx_k_crop[] = "crop";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_draw[] = "draw";
static const char __pyx_k_easy[] = "easy";
static const char __pyx_k_game[] = "game";
static const char __pyx_k_id_d[] = "id_d";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_line[] = "line";
static const char __pyx_k_main[] = "main";
static const char __pyx_k_mark[] = "mark";
static const char __pyx_k_mask[] = "mask";
static const char __pyx_k_math[] = "math";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_plog[] = "plog";
static const char __pyx_k_rect[] = "rect";
static const char __pyx_k_root[] = "root";
static const char __pyx_k_seen[] = "seen";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_sort[] = "sort";
static const char __pyx_k_surf[] = "surf";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_when[] = "when";
static const char __pyx_k_Focus[] = "Focus";
static const char __pyx_k_Modal[] = "Modal";
static const char __pyx_k_Solid[] = "Solid";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_blend[] = "blend";
static const char __pyx_k_class[] = "__class__";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_cmaxx[] = "cmaxx";
static const char __pyx_k_cmaxy[] = "cmaxy";
static const char __pyx_k_cminx[] = "cminx";
static const char __pyx_k_cminy[] = "cminy";
static const char __pyx_k_color[] = "color";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_depth[] = "depth";
static const char __pyx_k_focus[] = "focus";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_lines[] = "lines";
static const char __pyx_k_place[] = "place";
static const char __pyx_k_renpy[] = "renpy";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_style[] = "style";
static const char __pyx_k_width[] = "width";
static const char __pyx_k_xzoom[] = "xzoom";
static const char __pyx_k_yzoom[] = "yzoom";
static const char __pyx_k_Canvas[] = "Canvas";
static const char __pyx_k_aaline[] = "aaline";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_circle[] = "circle";
static const char __pyx_k_closed[] = "closed";
static const char __pyx_k_config[] = "config";
static const char __pyx_k_endpos[] = "endpos";
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_layers[] = "layers";
static const char __pyx_k_main_2[] = "__main__";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_offset[] = "offset";
static const char __pyx_k_opaque[] = "opaque";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_pygame[] = "pygame";
static const char __pyx_k_radius[] = "radius";
static const char __pyx_k_redraw[] = "redraw";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_render[] = "render";
static const char __pyx_k_screen[] = "screen";
static const char __pyx_k_source[] = "source";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_widtho[] = "widtho";
static const char __pyx_k_aalines[] = "aalines";
static const char __pyx_k_acquire[] = "acquire";
static const char __pyx_k_at_base[] = "at_base";
static const char __pyx_k_collect[] = "collect";
static const char __pyx_k_discard[] = "discard";
static const char __pyx_k_display[] = "display";
static const char __pyx_k_ellipse[] = "ellipse";
static const char __pyx_k_end_pos[] = "end_pos";
static const char __pyx_k_focuses[] = "focuses";
static const char __pyx_k_heighto[] = "heighto";
static const char __pyx_k_objects[] = "objects";
static const char __pyx_k_parents[] = "parents";
static const char __pyx_k_polygon[] = "polygon";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_release[] = "release";
static const char __pyx_k_renders[] = "renders";
static const char __pyx_k_reverse[] = "reverse";
static const char __pyx_k_st_base[] = "st_base";
static const char __pyx_k_surface[] = "surface";
static const char __pyx_k_DISSOLVE[] = "DISSOLVE";
static const char __pyx_k_IDENTITY[] = "IDENTITY";
static const char __pyx_k_Sentinel[] = "Sentinel";
static const char __pyx_k_absolute[] = "absolute";
static const char __pyx_k_clipping[] = "_clipping";
static const char __pyx_k_get_size[] = "get_size";
static const char __pyx_k_get_time[] = "get_time";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_new_time[] = "new_time";
static const char __pyx_k_old_time[] = "old_time";
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_setstate[] = "__setstate__";
static const char __pyx_k_startpos[] = "startpos";
static const char __pyx_k_surftree[] = "surftree";
static const char __pyx_k_worklist[] = "worklist";
static const char __pyx_k_xmaximum[] = "xmaximum";
static const char __pyx_k_ymaximum[] = "ymaximum";
static const char __pyx_k_Condition[] = "Condition";
static const char __pyx_k_PIXELLATE[] = "PIXELLATE";
static const char __pyx_k_add_focus[] = "add_focus";
static const char __pyx_k_blit_lock[] = "blit_lock";
static const char __pyx_k_developer[] = "developer";
static const char __pyx_k_draw_func[] = "draw_func";
static const char __pyx_k_imagelike[] = "imagelike";
static const char __pyx_k_interface[] = "interface";
static const char __pyx_k_is_opaque[] = "is_opaque";
static const char __pyx_k_iteritems[] = "iteritems";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_per_frame[] = "per_frame";
static const char __pyx_k_pointlist[] = "pointlist";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_render_at[] = "render_at";
static const char __pyx_k_render_of[] = "render_of";
static const char __pyx_k_render_st[] = "render_st";
static const char __pyx_k_start_pos[] = "start_pos";
static const char __pyx_k_threading[] = "threading";
static const char __pyx_k_transform[] = "transform";
static const char __pyx_k_xclipping[] = "xclipping";
static const char __pyx_k_yclipping[] = "yclipping";
static const char __pyx_k_Canvas_arc[] = "Canvas.arc";
static const char __pyx_k_depends_on[] = "depends_on";
static const char __pyx_k_frame_time[] = "frame_time";
static const char __pyx_k_invalidate[] = "invalidate";
static const char __pyx_k_kill_cache[] = "kill_cache";
static const char __pyx_k_layer_name[] = "layer_name";
static const char __pyx_k_mark_sweep[] = "mark_sweep";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_stop_angle[] = "stop_angle";
static const char __pyx_k_subsurface[] = "subsurface";
static const char __pyx_k_Canvas_line[] = "Canvas.line";
static const char __pyx_k_Canvas_rect[] = "Canvas.rect";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_collections[] = "collections";
static const char __pyx_k_defaultdict[] = "defaultdict";
static const char __pyx_k_free_memory[] = "free_memory";
static const char __pyx_k_get_objects[] = "get_objects";
static const char __pyx_k_get_surface[] = "get_surface";
static const char __pyx_k_invalidated[] = "invalidated";
static const char __pyx_k_new_renders[] = "new_renders";
static const char __pyx_k_pygame_sdl2[] = "pygame_sdl2";
static const char __pyx_k_redraw_time[] = "redraw_time";
static const char __pyx_k_start_angle[] = "start_angle";
static const char __pyx_k_Canvas_lines[] = "Canvas.lines";
static const char __pyx_k_cache_killed[] = "cache_killed";
static const char __pyx_k_end_render_r[] = "end render {!r}";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_redraw_queue[] = "redraw_queue";
static const char __pyx_k_render_cache[] = "render_cache";
static const char __pyx_k_render_ready[] = "render_ready";
static const char __pyx_k_stringsource[] = "stringsource";
static const char __pyx_k_take_focuses[] = "take_focuses";
static const char __pyx_k_Canvas___init[] = "Canvas.__init__";
static const char __pyx_k_Canvas_aaline[] = "Canvas.aaline";
static const char __pyx_k_Canvas_circle[] = "Canvas.circle";
static const char __pyx_k_IMAGEDISSOLVE[] = "IMAGEDISSOLVE";
static const char __pyx_k_Render_x_of_r[] = "<Render %x of %r>";
static const char __pyx_k_absolute_blit[] = "absolute_blit";
static const char __pyx_k_interact_time[] = "interact_time";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_render_screen[] = "render_screen";
static const char __pyx_k_screen_render[] = "screen_render";
static const char __pyx_k_subpixel_blit[] = "subpixel_blit";
static const char __pyx_k_Canvas_aalines[] = "Canvas.aalines";
static const char __pyx_k_Canvas_ellipse[] = "Canvas.ellipse";
static const char __pyx_k_Canvas_polygon[] = "Canvas.polygon";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_after_clipping[] = "after clipping";
static const char __pyx_k_focus_at_point[] = "focus_at_point";
static const char __pyx_k_pygame_surface[] = "pygame_surface";
static const char __pyx_k_start_render_r[] = "start render {!r}";
static const char __pyx_k_before_clipping[] = "before clipping";
static const char __pyx_k_compute_subline[] = "compute_subline";
static const char __pyx_k_is_pixel_opaque[] = "is_pixel_opaque";
static const char __pyx_k_is_unit_aligned[] = "is_unit_aligned";
static const char __pyx_k_mutated_surface[] = "mutated_surface";
static const char __pyx_k_process_redraws[] = "process_redraws";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_Blitting_to_self[] = "Blitting to self.";
static const char __pyx_k_new_redraw_queue[] = "new_redraw_queue";
static const char __pyx_k_ScreenDisplayable[] = "ScreenDisplayable";
static const char __pyx_k_check_at_shutdown[] = "check_at_shutdown";
static const char __pyx_k_render_to_texture[] = "render_to_texture";
static const char __pyx_k_Canvas_get_surface[] = "Canvas.get_surface";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_pyx_unpickle_Render[] = "__pyx_unpickle_Render";
static const char __pyx_k_renpy_display_render[] = "renpy.display.render";
static const char __pyx_k_Can_t_pickle_a_Render[] = "Can't pickle a Render.";
static const char __pyx_k_pyx_unpickle_Matrix2D[] = "__pyx_unpickle_Matrix2D";
static const char __pyx_k_Render_depends_on_itself[] = "Render depends on itself.";
static const char __pyx_k_adjust_render_cache_times[] = "adjust_render_cache_times";
static const char __pyx_k_main_displayables_at_point[] = "main_displayables_at_point";
static const char __pyx_k_r_render_must_return_a_Render[] = "{!r}.render() must return a Render.";
static const char __pyx_k_d_Renders_are_alive_at_shutdown[] = "%d Renders are alive at shutdown. This is probably a memory leak bug in Ren'Py.";
static const char __pyx_k_home_tom_ab_renpy_renpy_display[] = "/home/tom/ab/renpy/renpy/display/render.pyx";
static const char __pyx_k_Creating_subsurface_failed_child[] = "Creating subsurface failed. child size = ({}, {}), crop = {!r}";
static const char __pyx_k_Displayables_may_not_be_rendered[] = "Displayables may not be rendered during the init phase.";
static const char __pyx_k_Incompatible_checksums_s_vs_0x31[] = "Incompatible checksums (%s vs 0x3190674 = (xdx, xdy, ydx, ydy))";
static const char __pyx_k_Incompatible_checksums_s_vs_0xc9[] = "Incompatible checksums (%s vs 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))";
static const char __pyx_k_Matrix2D_xdx_f_xdy_f_ydx_f_ydy_f[] = "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)";
static PyObject *__pyx_n_s_BLIT;
static PyObject *__pyx_kp_s_Blitting_to_self;
static PyObject *__pyx_kp_s_Can_t_pickle_a_Render;
static PyObject *__pyx_n_s_Canvas;
static PyObject *__pyx_n_s_Canvas___init;
static PyObject *__pyx_n_s_Canvas_aaline;
static PyObject *__pyx_n_s_Canvas_aalines;
static PyObject *__pyx_n_s_Canvas_arc;
static PyObject *__pyx_n_s_Canvas_circle;
static PyObject *__pyx_n_s_Canvas_ellipse;
static PyObject *__pyx_n_s_Canvas_get_surface;
static PyObject *__pyx_n_s_Canvas_line;
static PyObject *__pyx_n_s_Canvas_lines;
static PyObject *__pyx_n_s_Canvas_polygon;
static PyObject *__pyx_n_s_Canvas_rect;
static PyObject *__pyx_n_s_Condition;
static PyObject *__pyx_kp_s_Creating_subsurface_failed_child;
static PyObject *__pyx_n_s_DISSOLVE;
static PyObject *__pyx_kp_s_Displayables_may_not_be_rendered;
static PyObject *__pyx_n_s_Focus;
static PyObject *__pyx_n_s_IDENTITY;
static PyObject *__pyx_n_s_IMAGEDISSOLVE;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x31;
static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xc9;
static PyObject *__pyx_kp_s_Matrix2D_xdx_f_xdy_f_ydx_f_ydy_f;
static PyObject *__pyx_n_s_Modal;
static PyObject *__pyx_n_s_NotImplemented;
static PyObject *__pyx_n_s_PIXELLATE;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_kp_s_Render_depends_on_itself;
static PyObject *__pyx_kp_s_Render_x_of_r;
static PyObject *__pyx_n_s_ScreenDisplayable;
static PyObject *__pyx_n_s_Sentinel;
static PyObject *__pyx_n_s_Solid;
static PyObject *__pyx_n_s_aaline;
static PyObject *__pyx_n_s_aalines;
static PyObject *__pyx_n_s_absolute;
static PyObject *__pyx_n_s_absolute_blit;
static PyObject *__pyx_n_s_acquire;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_add_focus;
static PyObject *__pyx_n_s_adjust_render_cache_times;
static PyObject *__pyx_kp_s_after_clipping;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_arc;
static PyObject *__pyx_n_s_arg;
static PyObject *__pyx_n_s_at;
static PyObject *__pyx_n_s_at_base;
static PyObject *__pyx_kp_s_before_clipping;
static PyObject *__pyx_n_s_blend;
static PyObject *__pyx_n_s_blit;
static PyObject *__pyx_n_s_blit_lock;
static PyObject *__pyx_n_s_cache_killed;
static PyObject *__pyx_n_s_ceil;
static PyObject *__pyx_n_s_cf;
static PyObject *__pyx_n_s_check_at_shutdown;
static PyObject *__pyx_n_s_circle;
static PyObject *__pyx_n_s_class;
static PyObject *__pyx_n_s_clear;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_clipping;
static PyObject *__pyx_n_s_closed;
static PyObject *__pyx_n_s_cmaxx;
static PyObject *__pyx_n_s_cmaxy;
static PyObject *__pyx_n_s_cminx;
static PyObject *__pyx_n_s_cminy;
static PyObject *__pyx_n_s_collect;
static PyObject *__pyx_n_s_collections;
static PyObject *__pyx_n_s_color;
static PyObject *__pyx_n_s_compute_subline;
static PyObject *__pyx_n_s_config;
static PyObject *__pyx_n_s_core;
static PyObject *__pyx_n_s_count;
static PyObject *__pyx_n_s_crop;
static PyObject *__pyx_n_s_cw;
static PyObject *__pyx_n_s_cx0;
static PyObject *__pyx_n_s_cx1;
static PyObject *__pyx_n_s_d;
static PyObject *__pyx_kp_s_d_Renders_are_alive_at_shutdown;
static PyObject *__pyx_n_s_defaultdict;
static PyObject *__pyx_n_s_depends_on;
static PyObject *__pyx_n_s_depth;
static PyObject *__pyx_n_s_developer;
static PyObject *__pyx_n_s_dict;
static PyObject *__pyx_n_s_discard;
static PyObject *__pyx_n_s_display;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_draw;
static PyObject *__pyx_n_s_draw_func;
static PyObject *__pyx_n_s_easy;
static PyObject *__pyx_n_s_ellipse;
static PyObject *__pyx_n_s_end_pos;
static PyObject *__pyx_kp_s_end_render_r;
static PyObject *__pyx_n_s_endpos;
static PyObject *__pyx_n_s_focus;
static PyObject *__pyx_n_s_focus_at_point;
static PyObject *__pyx_n_s_focuses;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_frame_time;
static PyObject *__pyx_n_s_free_memory;
static PyObject *__pyx_n_s_game;
static PyObject *__pyx_n_s_gc;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_get_objects;
static PyObject *__pyx_n_s_get_size;
static PyObject *__pyx_n_s_get_surface;
static PyObject *__pyx_n_s_get_time;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_height;
static PyObject *__pyx_n_s_heighto;
static PyObject *__pyx_kp_s_home_tom_ab_renpy_renpy_display;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_id;
static PyObject *__pyx_n_s_id_d;
static PyObject *__pyx_n_s_imagelike;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_index;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_interact_time;
static PyObject *__pyx_n_s_interface;
static PyObject *__pyx_n_s_invalidate;
static PyObject *__pyx_n_s_invalidated;
static PyObject *__pyx_n_s_is_opaque;
static PyObject *__pyx_n_s_is_pixel_opaque;
static PyObject *__pyx_n_s_is_unit_aligned;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_kill_cache;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_layer_name;
static PyObject *__pyx_n_s_layers;
static PyObject *__pyx_n_s_line;
static PyObject *__pyx_n_s_lines;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_main_2;
static PyObject *__pyx_n_s_main_displayables_at_point;
static PyObject *__pyx_n_s_mark;
static PyObject *__pyx_n_s_mark_sweep;
static PyObject *__pyx_n_s_mask;
static PyObject *__pyx_n_s_math;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_mutated_surface;
static PyObject *__pyx_n_s_mx;
static PyObject *__pyx_n_s_my;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_new;
static PyObject *__pyx_n_s_new_redraw_queue;
static PyObject *__pyx_n_s_new_renders;
static PyObject *__pyx_n_s_new_time;
static PyObject *__pyx_n_s_now;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_objects;
static PyObject *__pyx_n_s_offset;
static PyObject *__pyx_n_s_old_time;
static PyObject *__pyx_n_s_opaque;
static PyObject *__pyx_n_s_parents;
static PyObject *__pyx_n_s_per_frame;
static PyObject *__pyx_n_s_pgrender;
static PyObject *__pyx_n_s_pickle;
static PyObject *__pyx_n_s_place;
static PyObject *__pyx_n_s_plog;
static PyObject *__pyx_n_s_pointlist;
static PyObject *__pyx_n_s_polygon;
static PyObject *__pyx_n_s_pos;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_process_redraws;
static PyObject *__pyx_n_s_pygame;
static PyObject *__pyx_n_s_pygame_sdl2;
static PyObject *__pyx_n_s_pygame_surface;
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_Matrix2D;
static PyObject *__pyx_n_s_pyx_unpickle_Render;
static PyObject *__pyx_n_s_pyx_vtable;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_r;
static PyObject *__pyx_kp_s_r_render_must_return_a_Render;
static PyObject *__pyx_n_s_radius;
static PyObject *__pyx_n_s_rect;
static PyObject *__pyx_n_s_redraw;
static PyObject *__pyx_n_s_redraw_queue;
static PyObject *__pyx_n_s_redraw_time;
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_release;
static PyObject *__pyx_n_s_render;
static PyObject *__pyx_n_s_render_at;
static PyObject *__pyx_n_s_render_cache;
static PyObject *__pyx_n_s_render_of;
static PyObject *__pyx_n_s_render_ready;
static PyObject *__pyx_n_s_render_screen;
static PyObject *__pyx_n_s_render_st;
static PyObject *__pyx_n_s_render_to_texture;
static PyObject *__pyx_n_s_renders;
static PyObject *__pyx_n_s_renpy;
static PyObject *__pyx_n_s_renpy_display_render;
static PyObject *__pyx_n_s_reverse;
static PyObject *__pyx_n_s_root;
static PyObject *__pyx_n_s_rv;
static PyObject *__pyx_n_s_screen;
static PyObject *__pyx_n_s_screen_render;
static PyObject *__pyx_n_s_seen;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_sort;
static PyObject *__pyx_n_s_source;
static PyObject *__pyx_n_s_st;
static PyObject *__pyx_n_s_st_base;
static PyObject *__pyx_n_s_start;
static PyObject *__pyx_n_s_start_angle;
static PyObject *__pyx_n_s_start_pos;
static PyObject *__pyx_kp_s_start_render_r;
static PyObject *__pyx_n_s_startpos;
static PyObject *__pyx_n_s_stop_angle;
static PyObject *__pyx_kp_s_stringsource;
static PyObject *__pyx_n_s_style;
static PyObject *__pyx_n_s_subpixel_blit;
static PyObject *__pyx_n_s_subsurface;
static PyObject *__pyx_n_s_surf;
static PyObject *__pyx_n_s_surface;
static PyObject *__pyx_n_s_surftree;
static PyObject *__pyx_n_s_sw;
static PyObject *__pyx_n_s_sx;
static PyObject *__pyx_n_s_sx0;
static PyObject *__pyx_n_s_sx1;
static PyObject *__pyx_n_s_sy;
static PyObject *__pyx_n_s_t;
static PyObject *__pyx_n_s_take_focuses;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_threading;
static PyObject *__pyx_n_s_transform;
static PyObject *__pyx_n_s_update;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_when;
static PyObject *__pyx_n_s_width;
static PyObject *__pyx_n_s_widtho;
static PyObject *__pyx_n_s_worklist;
static PyObject *__pyx_n_s_x;
static PyObject *__pyx_n_s_xclipping;
static PyObject *__pyx_n_s_xdx;
static PyObject *__pyx_n_s_xdy;
static PyObject *__pyx_n_s_xmaximum;
static PyObject *__pyx_n_s_xzoom;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_yclipping;
static PyObject *__pyx_n_s_ydx;
static PyObject *__pyx_n_s_ydy;
static PyObject *__pyx_n_s_ymaximum;
static PyObject *__pyx_n_s_yzoom;
static PyObject *__pyx_pf_5renpy_7display_6render_adjust_render_cache_times(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_old_time, PyObject *__pyx_v_new_time); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_2free_memory(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_4check_at_shutdown(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6render_ready(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8render(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d, PyObject *__pyx_v_widtho, PyObject *__pyx_v_heighto, double __pyx_v_st, double __pyx_v_at); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_10invalidate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_12process_redraws(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_14redraw_time(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_16redraw(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d, PyObject *__pyx_v_when); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D___getstate__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_2__setstate__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_state); /* proto */
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_4__init__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, double __pyx_v_xdx, double __pyx_v_xdy, double __pyx_v_ydx, double __pyx_v_ydy); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_6transform(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, double __pyx_v_x, double __pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_8__mul__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_other); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_10__repr__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_12__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_op); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_14is_unit_aligned(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_16__reduce_cython__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_18__setstate_cython__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_18take_focuses(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_focuses); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_20focus_at_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_22mutated_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surf); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_24render_screen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_root, PyObject *__pyx_v_width, PyObject *__pyx_v_height); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_26mark_sweep(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_28compute_subline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sx0, PyObject *__pyx_v_sw, PyObject *__pyx_v_cx0, PyObject *__pyx_v_cw); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render___init__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, float __pyx_v_width, float __pyx_v_height, PyObject *__pyx_v_draw_func, PyObject *__pyx_v_layer_name, int __pyx_v_opaque); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_2__repr__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4__getstate__(CYTHON_UNUSED struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6__setstate__(CYTHON_UNUSED struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, PyObject *__pyx_v_focus, PyObject *__pyx_v_main, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10subpixel_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, PyObject *__pyx_v_focus, PyObject *__pyx_v_main, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12absolute_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, PyObject *__pyx_v_focus, PyObject *__pyx_v_main, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_14get_size(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16render_to_texture(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18subsurface(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_rect, PyObject *__pyx_v_focus); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_20depends_on(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_focus); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_22kill_cache(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_24kill(CYTHON_UNUSED struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_26add_focus(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_d, PyObject *__pyx_v_arg, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mask); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_28take_focuses(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_cminx, PyObject *__pyx_v_cminy, PyObject *__pyx_v_cmaxx, PyObject *__pyx_v_cmaxy, PyObject *__pyx_v_reverse, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_screen, PyObject *__pyx_v_focuses); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_30focus_at_point(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_screen); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_32main_displayables_at_point(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_layers, PyObject *__pyx_v_depth); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_34is_opaque(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_36is_pixel_opaque(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_38fill(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_color); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_40canvas(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_42screen_rect(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, double __pyx_v_sx, double __pyx_v_sy, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_transform); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_44place(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_d, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_width, PyObject *__pyx_v_height, PyObject *__pyx_v_st, PyObject *__pyx_v_at, PyObject *__pyx_v_render, PyObject *__pyx_v_main); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_46zoom(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_xzoom, PyObject *__pyx_v_yzoom); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4mark___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_4mark_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_12cache_killed_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5width___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_5width_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6height___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_6height_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10layer_name___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8children___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_8children_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_8children_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7parents___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7parents_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7parents_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15depends_on_list___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9operation___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_9operation_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_18operation_complete_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_19operation_parameter___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7forward___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7forward_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7forward_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7reverse___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_5alpha_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4over___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_4over_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7nearest___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7nearest_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7nearest_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7focuses___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12pass_focuses___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12focus_screen___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_12focus_screen_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_12focus_screen_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9draw_func___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9render_of___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_6opaque_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16visible_children___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9xclipping___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_9xclipping_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9yclipping___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_9yclipping_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7surface___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7surface_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7surface_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_13alpha_surface___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10half_cache___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5modal___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_5modal_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10text_input___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_10text_input_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_48__reduce_cython__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_50__setstate_cython__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_surf); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_2rect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_rect, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_4polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_pointlist, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_6circle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_pos, PyObject *__pyx_v_radius, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_8ellipse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_rect, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_10arc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_rect, PyObject *__pyx_v_start_angle, PyObject *__pyx_v_stop_angle, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_12line(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_start_pos, PyObject *__pyx_v_end_pos, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_14lines(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_closed, PyObject *__pyx_v_pointlist, PyObject *__pyx_v_width); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_16aaline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_startpos, PyObject *__pyx_v_endpos, PyObject *__pyx_v_blend); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_18aalines(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_closed, PyObject *__pyx_v_pointlist, PyObject *__pyx_v_blend); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_20get_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_30__pyx_unpickle_Matrix2D(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_7display_6render_32__pyx_unpickle_Render(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_7display_6render_Matrix2D(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_7display_6render_Render(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_1_0;
static PyObject *__pyx_float__00001;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_51971700;
static PyObject *__pyx_int_211505806;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__6;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_slice__9;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__41;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__45;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__52;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__58;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__64;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_codeobj__14;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__17;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__20;
static PyObject *__pyx_codeobj__22;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__31;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__39;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__44;
static PyObject *__pyx_codeobj__47;
static PyObject *__pyx_codeobj__50;
static PyObject *__pyx_codeobj__53;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__59;
static PyObject *__pyx_codeobj__62;
static PyObject *__pyx_codeobj__65;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__71;
static PyObject *__pyx_codeobj__73;
static PyObject *__pyx_codeobj__75;

/* "renpy/display/render.pyx":59
 * per_frame = False
 * 
 * def adjust_render_cache_times(old_time, new_time):             # <<<<<<<<<<<<<<
 *     """
 *     This adjusts the render cache such that if a render starts at
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_1adjust_render_cache_times(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_adjust_render_cache_times[] = "\n    This adjusts the render cache such that if a render starts at\n    old_time, it really started at new_time.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_1adjust_render_cache_times = {"adjust_render_cache_times", (PyCFunction)__pyx_pw_5renpy_7display_6render_1adjust_render_cache_times, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_adjust_render_cache_times};
static PyObject *__pyx_pw_5renpy_7display_6render_1adjust_render_cache_times(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_old_time = 0;
  PyObject *__pyx_v_new_time = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("adjust_render_cache_times (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_old_time,&__pyx_n_s_new_time,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_old_time)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_new_time)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("adjust_render_cache_times", 1, 2, 2, 1); __PYX_ERR(0, 59, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "adjust_render_cache_times") < 0)) __PYX_ERR(0, 59, __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_old_time = values[0];
    __pyx_v_new_time = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("adjust_render_cache_times", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 59, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.adjust_render_cache_times", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_adjust_render_cache_times(__pyx_self, __pyx_v_old_time, __pyx_v_new_time);

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

static PyObject *__pyx_pf_5renpy_7display_6render_adjust_render_cache_times(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_old_time, PyObject *__pyx_v_new_time) {
  PyObject *__pyx_v_id_d = NULL;
  PyObject *__pyx_v_renders = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_new_renders = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_v_st_base = NULL;
  PyObject *__pyx_v_at_base = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *(*__pyx_t_17)(PyObject *);
  __Pyx_RefNannySetupContext("adjust_render_cache_times", 0);

  /* "renpy/display/render.pyx":65
 *     """
 * 
 *     for id_d, renders in render_cache.iteritems():             # <<<<<<<<<<<<<<
 * 
 *         # Check to see if we have a render with st_base = old_time. If so,
 */
  __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (unlikely(__pyx_t_5 == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
    __PYX_ERR(0, 65, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(__pyx_t_5, 0, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 65, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_id_d, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_renders, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":69
 *         # Check to see if we have a render with st_base = old_time. If so,
 *         # we need to rebase it.
 *         for k in renders:             # <<<<<<<<<<<<<<
 *             if k[2] == old_time:
 *                 break
 */
    if (likely(PyList_CheckExact(__pyx_v_renders)) || PyTuple_CheckExact(__pyx_v_renders)) {
      __pyx_t_5 = __pyx_v_renders; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_renders); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 69, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 69, __pyx_L1_error)
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_6);
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_9(__pyx_t_5);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 69, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "renpy/display/render.pyx":70
 *         # we need to rebase it.
 *         for k in renders:
 *             if k[2] == old_time:             # <<<<<<<<<<<<<<
 *                 break
 *         else:
 */
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_k, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_10 = PyObject_RichCompare(__pyx_t_6, __pyx_v_old_time, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 70, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_11) {

        /* "renpy/display/render.pyx":71
 *         for k in renders:
 *             if k[2] == old_time:
 *                 break             # <<<<<<<<<<<<<<
 *         else:
 *             continue
 */
        goto __pyx_L6_break;

        /* "renpy/display/render.pyx":70
 *         # we need to rebase it.
 *         for k in renders:
 *             if k[2] == old_time:             # <<<<<<<<<<<<<<
 *                 break
 *         else:
 */
      }

      /* "renpy/display/render.pyx":69
 *         # Check to see if we have a render with st_base = old_time. If so,
 *         # we need to rebase it.
 *         for k in renders:             # <<<<<<<<<<<<<<
 *             if k[2] == old_time:
 *                 break
 */
    }
    /*else*/ {

      /* "renpy/display/render.pyx":73
 *                 break
 *         else:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         new_renders = { }
 */
      goto __pyx_L8_outer_continue;
    }
    goto __pyx_L6_break;

    /* "renpy/display/render.pyx":69
 *         # Check to see if we have a render with st_base = old_time. If so,
 *         # we need to rebase it.
 *         for k in renders:             # <<<<<<<<<<<<<<
 *             if k[2] == old_time:
 *                 break
 */
    __pyx_L8_outer_continue:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3_continue;
    __pyx_L6_break:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":75
 *             continue
 * 
 *         new_renders = { }             # <<<<<<<<<<<<<<
 * 
 *         for k, v in renders.iteritems():
 */
    __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_XDECREF_SET(__pyx_v_new_renders, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":77
 *         new_renders = { }
 * 
 *         for k, v in renders.iteritems():             # <<<<<<<<<<<<<<
 *             w, h, st_base, at_base = k
 * 
 */
    __pyx_t_8 = 0;
    if (unlikely(__pyx_v_renders == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems");
      __PYX_ERR(0, 77, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_dict_iterator(__pyx_v_renders, 0, __pyx_n_s_iteritems, (&__pyx_t_12), (&__pyx_t_7)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 77, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_XDECREF(__pyx_t_5);
    __pyx_t_5 = __pyx_t_10;
    __pyx_t_10 = 0;
    while (1) {
      __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_12, &__pyx_t_8, &__pyx_t_10, &__pyx_t_6, NULL, __pyx_t_7);
      if (unlikely(__pyx_t_13 == 0)) break;
      if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 77, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF_SET(__pyx_v_k, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "renpy/display/render.pyx":78
 * 
 *         for k, v in renders.iteritems():
 *             w, h, st_base, at_base = k             # <<<<<<<<<<<<<<
 * 
 *             if st_base == old_time:
 */
      if ((likely(PyTuple_CheckExact(__pyx_v_k))) || (PyList_CheckExact(__pyx_v_k))) {
        PyObject* sequence = __pyx_v_k;
        #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, 78, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_15 = PyTuple_GET_ITEM(sequence, 3); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_15 = PyList_GET_ITEM(sequence, 3); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_15);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_10,&__pyx_t_14,&__pyx_t_15};
          for (i=0; i < 4; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 78, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[4] = {&__pyx_t_6,&__pyx_t_10,&__pyx_t_14,&__pyx_t_15};
        __pyx_t_16 = PyObject_GetIter(__pyx_v_k); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 78, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
        for (index=0; index < 4; index++) {
          PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 4) < 0) __PYX_ERR(0, 78, __pyx_L1_error)
        __pyx_t_17 = NULL;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_17 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 78, __pyx_L1_error)
        __pyx_L12_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_st_base, __pyx_t_14);
      __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_at_base, __pyx_t_15);
      __pyx_t_15 = 0;

      /* "renpy/display/render.pyx":80
 *             w, h, st_base, at_base = k
 * 
 *             if st_base == old_time:             # <<<<<<<<<<<<<<
 *                 st_base = new_time
 * 
 */
      __pyx_t_15 = PyObject_RichCompare(__pyx_v_st_base, __pyx_v_old_time, Py_EQ); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 80, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 80, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (__pyx_t_11) {

        /* "renpy/display/render.pyx":81
 * 
 *             if st_base == old_time:
 *                 st_base = new_time             # <<<<<<<<<<<<<<
 * 
 *             if at_base == old_time:
 */
        __Pyx_INCREF(__pyx_v_new_time);
        __Pyx_DECREF_SET(__pyx_v_st_base, __pyx_v_new_time);

        /* "renpy/display/render.pyx":80
 *             w, h, st_base, at_base = k
 * 
 *             if st_base == old_time:             # <<<<<<<<<<<<<<
 *                 st_base = new_time
 * 
 */
      }

      /* "renpy/display/render.pyx":83
 *                 st_base = new_time
 * 
 *             if at_base == old_time:             # <<<<<<<<<<<<<<
 *                 at_base = new_time
 * 
 */
      __pyx_t_15 = PyObject_RichCompare(__pyx_v_at_base, __pyx_v_old_time, Py_EQ); __Pyx_XGOTREF(__pyx_t_15); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 83, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (__pyx_t_11) {

        /* "renpy/display/render.pyx":84
 * 
 *             if at_base == old_time:
 *                 at_base = new_time             # <<<<<<<<<<<<<<
 * 
 *             new_renders[(w, h, st_base, at_base)] = v
 */
        __Pyx_INCREF(__pyx_v_new_time);
        __Pyx_DECREF_SET(__pyx_v_at_base, __pyx_v_new_time);

        /* "renpy/display/render.pyx":83
 *                 st_base = new_time
 * 
 *             if at_base == old_time:             # <<<<<<<<<<<<<<
 *                 at_base = new_time
 * 
 */
      }

      /* "renpy/display/render.pyx":86
 *                 at_base = new_time
 * 
 *             new_renders[(w, h, st_base, at_base)] = v             # <<<<<<<<<<<<<<
 * 
 *         render_cache[id_d] = new_renders
 */
      __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_v_w);
      __Pyx_GIVEREF(__pyx_v_w);
      PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_w);
      __Pyx_INCREF(__pyx_v_h);
      __Pyx_GIVEREF(__pyx_v_h);
      PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_h);
      __Pyx_INCREF(__pyx_v_st_base);
      __Pyx_GIVEREF(__pyx_v_st_base);
      PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_st_base);
      __Pyx_INCREF(__pyx_v_at_base);
      __Pyx_GIVEREF(__pyx_v_at_base);
      PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_at_base);
      if (unlikely(PyDict_SetItem(__pyx_v_new_renders, __pyx_t_15, __pyx_v_v) < 0)) __PYX_ERR(0, 86, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":88
 *             new_renders[(w, h, st_base, at_base)] = v
 * 
 *         render_cache[id_d] = new_renders             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_v_id_d, __pyx_v_new_renders) < 0)) __PYX_ERR(0, 88, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":59
 * per_frame = False
 * 
 * def adjust_render_cache_times(old_time, new_time):             # <<<<<<<<<<<<<<
 *     """
 *     This adjusts the render cache such that if a render starts at
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("renpy.display.render.adjust_render_cache_times", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id_d);
  __Pyx_XDECREF(__pyx_v_renders);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_new_renders);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_st_base);
  __Pyx_XDECREF(__pyx_v_at_base);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":91
 * 
 * 
 * def free_memory():             # <<<<<<<<<<<<<<
 *     """
 *     Frees memory used by the render system.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_3free_memory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_2free_memory[] = "\n    Frees memory used by the render system.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_3free_memory = {"free_memory", (PyCFunction)__pyx_pw_5renpy_7display_6render_3free_memory, METH_NOARGS, __pyx_doc_5renpy_7display_6render_2free_memory};
static PyObject *__pyx_pw_5renpy_7display_6render_3free_memory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("free_memory (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_2free_memory(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_2free_memory(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("free_memory", 0);

  /* "renpy/display/render.pyx":97
 * 
 *     global screen_render
 *     screen_render = None             # <<<<<<<<<<<<<<
 * 
 *     mark_sweep()
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_screen_render, Py_None) < 0) __PYX_ERR(0, 97, __pyx_L1_error)

  /* "renpy/display/render.pyx":99
 *     screen_render = None
 * 
 *     mark_sweep()             # <<<<<<<<<<<<<<
 * 
 *     render_cache.clear()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_mark_sweep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __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, 99, __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/display/render.pyx":101
 *     mark_sweep()
 * 
 *     render_cache.clear()             # <<<<<<<<<<<<<<
 * 
 *     # This can hang onto a render.
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 101, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_clear); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __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, 101, __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, 101, __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/display/render.pyx":104
 * 
 *     # This can hang onto a render.
 *     renpy.display.interface.surftree = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __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, 104, __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, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_surftree, Py_None) < 0) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":91
 * 
 * 
 * def free_memory():             # <<<<<<<<<<<<<<
 *     """
 *     Frees memory used by the render system.
 */

  /* 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.display.render.free_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":107
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_5check_at_shutdown(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_4check_at_shutdown[] = "\n    This is called at shutdown time to check that everything went okay.\n    The big thing it checks for is memory leaks.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_5check_at_shutdown = {"check_at_shutdown", (PyCFunction)__pyx_pw_5renpy_7display_6render_5check_at_shutdown, METH_NOARGS, __pyx_doc_5renpy_7display_6render_4check_at_shutdown};
static PyObject *__pyx_pw_5renpy_7display_6render_5check_at_shutdown(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_at_shutdown (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_4check_at_shutdown(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_4check_at_shutdown(CYTHON_UNUSED PyObject *__pyx_self) {
  CYTHON_UNUSED PyObject *__pyx_v_l = NULL;
  PyObject *__pyx_v_count = NULL;
  PyObject *__pyx_v_objects = NULL;
  PyObject *__pyx_v_i = 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;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  __Pyx_RefNannySetupContext("check_at_shutdown", 0);

  /* "renpy/display/render.pyx":113
 *     """
 * 
 *     if not renpy.config.developer:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __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, 113, __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_developer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __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, 113, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":114
 * 
 *     if not renpy.config.developer:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     free_memory()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":113
 *     """
 * 
 *     if not renpy.config.developer:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "renpy/display/render.pyx":116
 *         return
 * 
 *     free_memory()             # <<<<<<<<<<<<<<
 * 
 *     gc.collect()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_free_memory); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __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, 116, __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/display/render.pyx":118
 *     free_memory()
 * 
 *     gc.collect()             # <<<<<<<<<<<<<<
 *     l = gc.get_objects()
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_collect); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 118, __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 && 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);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __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, 118, __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/display/render.pyx":119
 * 
 *     gc.collect()
 *     l = gc.get_objects()             # <<<<<<<<<<<<<<
 * 
 *     count = 0
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 119, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_objects); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __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, 119, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_l = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":121
 *     l = gc.get_objects()
 * 
 *     count = 0             # <<<<<<<<<<<<<<
 *     objects = gc.get_objects()
 * 
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_count = __pyx_int_0;

  /* "renpy/display/render.pyx":122
 * 
 *     count = 0
 *     objects = gc.get_objects()             # <<<<<<<<<<<<<<
 * 
 *     for i in objects:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_gc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_objects); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 122, __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 && 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);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 122, __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, 122, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_objects = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":124
 *     objects = gc.get_objects()
 * 
 *     for i in objects:             # <<<<<<<<<<<<<<
 *         if isinstance(i, Render):
 *             count += 1
 */
  if (likely(PyList_CheckExact(__pyx_v_objects)) || PyTuple_CheckExact(__pyx_v_objects)) {
    __pyx_t_1 = __pyx_v_objects; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_objects); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 124, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":125
 * 
 *     for i in objects:
 *         if isinstance(i, Render):             # <<<<<<<<<<<<<<
 *             count += 1
 * 
 */
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_i, __pyx_ptype_5renpy_7display_6render_Render); 
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":126
 *     for i in objects:
 *         if isinstance(i, Render):
 *             count += 1             # <<<<<<<<<<<<<<
 * 
 *     if count:
 */
      __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_v_count, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF_SET(__pyx_v_count, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":125
 * 
 *     for i in objects:
 *         if isinstance(i, Render):             # <<<<<<<<<<<<<<
 *             count += 1
 * 
 */
    }

    /* "renpy/display/render.pyx":124
 *     objects = gc.get_objects()
 * 
 *     for i in objects:             # <<<<<<<<<<<<<<
 *         if isinstance(i, Render):
 *             count += 1
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":128
 *             count += 1
 * 
 *     if count:             # <<<<<<<<<<<<<<
 *         raise Exception("%d Renders are alive at shutdown. This is probably a memory leak bug in Ren'Py." % count)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_count); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":129
 * 
 *     if count:
 *         raise Exception("%d Renders are alive at shutdown. This is probably a memory leak bug in Ren'Py." % count)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_d_Renders_are_alive_at_shutdown, __pyx_v_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __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(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 129, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(0, 129, __pyx_L1_error)

    /* "renpy/display/render.pyx":128
 *             count += 1
 * 
 *     if count:             # <<<<<<<<<<<<<<
 *         raise Exception("%d Renders are alive at shutdown. This is probably a memory leak bug in Ren'Py." % count)
 * 
 */
  }

  /* "renpy/display/render.pyx":107
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */

  /* 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_5);
  __Pyx_AddTraceback("renpy.display.render.check_at_shutdown", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_count);
  __Pyx_XDECREF(__pyx_v_objects);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":143
 * render_is_ready = 0
 * 
 * def render_ready():             # <<<<<<<<<<<<<<
 *     global render_is_ready
 *     render_is_ready = 1
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_7render_ready(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_7render_ready = {"render_ready", (PyCFunction)__pyx_pw_5renpy_7display_6render_7render_ready, METH_NOARGS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_7render_ready(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render_ready (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6render_ready(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6render_ready(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render_ready", 0);

  /* "renpy/display/render.pyx":145
 * def render_ready():
 *     global render_is_ready
 *     render_is_ready = 1             # <<<<<<<<<<<<<<
 * 
 * cpdef render(d, object widtho, object heighto, double st, double at):
 */
  __pyx_v_5renpy_7display_6render_render_is_ready = 1;

  /* "renpy/display/render.pyx":143
 * render_is_ready = 0
 * 
 * def render_ready():             # <<<<<<<<<<<<<<
 *     global render_is_ready
 *     render_is_ready = 1
 */

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

/* "renpy/display/render.pyx":147
 *     render_is_ready = 1
 * 
 * cpdef render(d, object widtho, object heighto, double st, double at):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */

static PyObject *__pyx_pw_5renpy_7display_6render_9render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5renpy_7display_6render_render(PyObject *__pyx_v_d, PyObject *__pyx_v_widtho, PyObject *__pyx_v_heighto, double __pyx_v_st, double __pyx_v_at, CYTHON_UNUSED int __pyx_skip_dispatch) {
  float __pyx_v_width;
  float __pyx_v_height;
  float __pyx_v_orig_width;
  float __pyx_v_orig_height;
  PyObject *__pyx_v_orig_wh = 0;
  PyObject *__pyx_v_wh = 0;
  PyObject *__pyx_v_render_cache_d = 0;
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rv = 0;
  PyObject *__pyx_v_id_d = NULL;
  PyObject *__pyx_v_style = NULL;
  PyObject *__pyx_v_xmaximum = NULL;
  PyObject *__pyx_v_ymaximum = NULL;
  PyObject *__pyx_v_old_st = NULL;
  PyObject *__pyx_v_old_at = 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;
  int __pyx_t_5;
  float __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  char const *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  __Pyx_RefNannySetupContext("render", 0);
  __Pyx_INCREF(__pyx_v_widtho);
  __Pyx_INCREF(__pyx_v_heighto);

  /* "renpy/display/render.pyx":178
 *     cdef Render rv
 * 
 *     if not render_is_ready:             # <<<<<<<<<<<<<<
 *         if renpy.config.developer:
 *             raise Exception("Displayables may not be rendered during the init phase.")
 */
  __pyx_t_1 = ((!(__pyx_v_5renpy_7display_6render_render_is_ready != 0)) != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":179
 * 
 *     if not render_is_ready:
 *         if renpy.config.developer:             # <<<<<<<<<<<<<<
 *             raise Exception("Displayables may not be rendered during the init phase.")
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_config); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __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_developer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 179, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 179, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":180
 *     if not render_is_ready:
 *         if renpy.config.developer:
 *             raise Exception("Displayables may not be rendered during the init phase.")             # <<<<<<<<<<<<<<
 * 
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)
 */
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 180, __pyx_L1_error)

      /* "renpy/display/render.pyx":179
 * 
 *     if not render_is_ready:
 *         if renpy.config.developer:             # <<<<<<<<<<<<<<
 *             raise Exception("Displayables may not be rendered during the init phase.")
 * 
 */
    }

    /* "renpy/display/render.pyx":178
 *     cdef Render rv
 * 
 *     if not render_is_ready:             # <<<<<<<<<<<<<<
 *         if renpy.config.developer:
 *             raise Exception("Displayables may not be rendered during the init phase.")
 */
  }

  /* "renpy/display/render.pyx":182
 *             raise Exception("Displayables may not be rendered during the init phase.")
 * 
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)             # <<<<<<<<<<<<<<
 * 
 *     id_d = id(d)
 */
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_st)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_at)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_widtho);
  __Pyx_GIVEREF(__pyx_v_widtho);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_widtho);
  __Pyx_INCREF(__pyx_v_heighto);
  __Pyx_GIVEREF(__pyx_v_heighto);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_heighto);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_v_orig_wh = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":184
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)
 * 
 *     id_d = id(d)             # <<<<<<<<<<<<<<
 *     render_cache_d = render_cache[id_d]
 *     rv = render_cache_d.get(orig_wh, None)
 */
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_d);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_id_d = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":185
 * 
 *     id_d = id(d)
 *     render_cache_d = render_cache[id_d]             # <<<<<<<<<<<<<<
 *     rv = render_cache_d.get(orig_wh, None)
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetItem(__pyx_t_3, __pyx_v_id_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyDict_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(0, 185, __pyx_L1_error)
  __pyx_v_render_cache_d = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":186
 *     id_d = id(d)
 *     render_cache_d = render_cache[id_d]
 *     rv = render_cache_d.get(orig_wh, None)             # <<<<<<<<<<<<<<
 * 
 *     if rv is not None:
 */
  if (unlikely(__pyx_v_render_cache_d == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
    __PYX_ERR(0, 186, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyDict_GetItemDefault(__pyx_v_render_cache_d, __pyx_v_orig_wh, Py_None); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5renpy_7display_6render_Render))))) __PYX_ERR(0, 186, __pyx_L1_error)
  __pyx_v_rv = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":188
 *     rv = render_cache_d.get(orig_wh, None)
 * 
 *     if rv is not None:             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_rv) != Py_None);
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":189
 * 
 *     if rv is not None:
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     orig_width = width = widtho
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_rv));
    __pyx_r = ((PyObject *)__pyx_v_rv);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":188
 *     rv = render_cache_d.get(orig_wh, None)
 * 
 *     if rv is not None:             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  }

  /* "renpy/display/render.pyx":191
 *         return rv
 * 
 *     orig_width = width = widtho             # <<<<<<<<<<<<<<
 *     orig_height = height = heighto
 * 
 */
  __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_v_widtho); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error)
  __pyx_v_orig_width = __pyx_t_6;
  __pyx_v_width = __pyx_t_6;

  /* "renpy/display/render.pyx":192
 * 
 *     orig_width = width = widtho
 *     orig_height = height = heighto             # <<<<<<<<<<<<<<
 * 
 *     style = d.style
 */
  __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_v_heighto); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L1_error)
  __pyx_v_orig_height = __pyx_t_6;
  __pyx_v_height = __pyx_t_6;

  /* "renpy/display/render.pyx":194
 *     orig_height = height = heighto
 * 
 *     style = d.style             # <<<<<<<<<<<<<<
 *     xmaximum = style.xmaximum
 *     ymaximum = style.ymaximum
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_style); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_style = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":195
 * 
 *     style = d.style
 *     xmaximum = style.xmaximum             # <<<<<<<<<<<<<<
 *     ymaximum = style.ymaximum
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_style, __pyx_n_s_xmaximum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_xmaximum = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":196
 *     style = d.style
 *     xmaximum = style.xmaximum
 *     ymaximum = style.ymaximum             # <<<<<<<<<<<<<<
 * 
 *     if xmaximum is not None:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_style, __pyx_n_s_ymaximum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_ymaximum = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":198
 *     ymaximum = style.ymaximum
 * 
 *     if xmaximum is not None:             # <<<<<<<<<<<<<<
 *         if isinstance(xmaximum, float):
 *             width = width * xmaximum
 */
  __pyx_t_5 = (__pyx_v_xmaximum != Py_None);
  __pyx_t_1 = (__pyx_t_5 != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":199
 * 
 *     if xmaximum is not None:
 *         if isinstance(xmaximum, float):             # <<<<<<<<<<<<<<
 *             width = width * xmaximum
 *         else:
 */
    __pyx_t_1 = PyFloat_Check(__pyx_v_xmaximum); 
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "renpy/display/render.pyx":200
 *     if xmaximum is not None:
 *         if isinstance(xmaximum, float):
 *             width = width * xmaximum             # <<<<<<<<<<<<<<
 *         else:
 *             width = min(xmaximum, width)
 */
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_v_xmaximum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_width = __pyx_t_6;

      /* "renpy/display/render.pyx":199
 * 
 *     if xmaximum is not None:
 *         if isinstance(xmaximum, float):             # <<<<<<<<<<<<<<
 *             width = width * xmaximum
 *         else:
 */
      goto __pyx_L7;
    }

    /* "renpy/display/render.pyx":202
 *             width = width * xmaximum
 *         else:
 *             width = min(xmaximum, width)             # <<<<<<<<<<<<<<
 * 
 *     if ymaximum is not None:
 */
    /*else*/ {
      __pyx_t_6 = __pyx_v_width;
      __Pyx_INCREF(__pyx_v_xmaximum);
      __pyx_t_3 = __pyx_v_xmaximum;
      __pyx_t_2 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_5) {
        __pyx_t_7 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = __pyx_t_3;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 202, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_width = __pyx_t_6;
    }
    __pyx_L7:;

    /* "renpy/display/render.pyx":198
 *     ymaximum = style.ymaximum
 * 
 *     if xmaximum is not None:             # <<<<<<<<<<<<<<
 *         if isinstance(xmaximum, float):
 *             width = width * xmaximum
 */
  }

  /* "renpy/display/render.pyx":204
 *             width = min(xmaximum, width)
 * 
 *     if ymaximum is not None:             # <<<<<<<<<<<<<<
 *         if isinstance(ymaximum, float):
 *             height = height * ymaximum
 */
  __pyx_t_5 = (__pyx_v_ymaximum != Py_None);
  __pyx_t_1 = (__pyx_t_5 != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":205
 * 
 *     if ymaximum is not None:
 *         if isinstance(ymaximum, float):             # <<<<<<<<<<<<<<
 *             height = height * ymaximum
 *         else:
 */
    __pyx_t_1 = PyFloat_Check(__pyx_v_ymaximum); 
    __pyx_t_5 = (__pyx_t_1 != 0);
    if (__pyx_t_5) {

      /* "renpy/display/render.pyx":206
 *     if ymaximum is not None:
 *         if isinstance(ymaximum, float):
 *             height = height * ymaximum             # <<<<<<<<<<<<<<
 *         else:
 *             height = min(ymaximum, height)
 */
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_v_ymaximum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_3); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 206, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_height = __pyx_t_6;

      /* "renpy/display/render.pyx":205
 * 
 *     if ymaximum is not None:
 *         if isinstance(ymaximum, float):             # <<<<<<<<<<<<<<
 *             height = height * ymaximum
 *         else:
 */
      goto __pyx_L9;
    }

    /* "renpy/display/render.pyx":208
 *             height = height * ymaximum
 *         else:
 *             height = min(ymaximum, height)             # <<<<<<<<<<<<<<
 * 
 *     if width < 0:
 */
    /*else*/ {
      __pyx_t_6 = __pyx_v_height;
      __Pyx_INCREF(__pyx_v_ymaximum);
      __pyx_t_3 = __pyx_v_ymaximum;
      __pyx_t_7 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_5) {
        __pyx_t_2 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __pyx_t_2;
        __pyx_t_2 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_4 = __pyx_t_3;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_6 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_height = __pyx_t_6;
    }
    __pyx_L9:;

    /* "renpy/display/render.pyx":204
 *             width = min(xmaximum, width)
 * 
 *     if ymaximum is not None:             # <<<<<<<<<<<<<<
 *         if isinstance(ymaximum, float):
 *             height = height * ymaximum
 */
  }

  /* "renpy/display/render.pyx":210
 *             height = min(ymaximum, height)
 * 
 *     if width < 0:             # <<<<<<<<<<<<<<
 *         width = 0
 *     if height < 0:
 */
  __pyx_t_5 = ((__pyx_v_width < 0.0) != 0);
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":211
 * 
 *     if width < 0:
 *         width = 0             # <<<<<<<<<<<<<<
 *     if height < 0:
 *         height = 0
 */
    __pyx_v_width = 0.0;

    /* "renpy/display/render.pyx":210
 *             height = min(ymaximum, height)
 * 
 *     if width < 0:             # <<<<<<<<<<<<<<
 *         width = 0
 *     if height < 0:
 */
  }

  /* "renpy/display/render.pyx":212
 *     if width < 0:
 *         width = 0
 *     if height < 0:             # <<<<<<<<<<<<<<
 *         height = 0
 * 
 */
  __pyx_t_5 = ((__pyx_v_height < 0.0) != 0);
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":213
 *         width = 0
 *     if height < 0:
 *         height = 0             # <<<<<<<<<<<<<<
 * 
 *     if orig_width != width or orig_height != height:
 */
    __pyx_v_height = 0.0;

    /* "renpy/display/render.pyx":212
 *     if width < 0:
 *         width = 0
 *     if height < 0:             # <<<<<<<<<<<<<<
 *         height = 0
 * 
 */
  }

  /* "renpy/display/render.pyx":215
 *         height = 0
 * 
 *     if orig_width != width or orig_height != height:             # <<<<<<<<<<<<<<
 *         widtho = width
 *         heighto = height
 */
  __pyx_t_1 = ((__pyx_v_orig_width != __pyx_v_width) != 0);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_5 = __pyx_t_1;
    goto __pyx_L13_bool_binop_done;
  }
  __pyx_t_1 = ((__pyx_v_orig_height != __pyx_v_height) != 0);
  __pyx_t_5 = __pyx_t_1;
  __pyx_L13_bool_binop_done:;
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":216
 * 
 *     if orig_width != width or orig_height != height:
 *         widtho = width             # <<<<<<<<<<<<<<
 *         heighto = height
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_widtho, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":217
 *     if orig_width != width or orig_height != height:
 *         widtho = width
 *         heighto = height             # <<<<<<<<<<<<<<
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)
 *         rv = render_cache_d.get(wh, None)
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_heighto, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":218
 *         widtho = width
 *         heighto = height
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)             # <<<<<<<<<<<<<<
 *         rv = render_cache_d.get(wh, None)
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_st)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_at)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_widtho);
    __Pyx_GIVEREF(__pyx_v_widtho);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_widtho);
    __Pyx_INCREF(__pyx_v_heighto);
    __Pyx_GIVEREF(__pyx_v_heighto);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_heighto);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_v_wh = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":219
 *         heighto = height
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)
 *         rv = render_cache_d.get(wh, None)             # <<<<<<<<<<<<<<
 * 
 *         if rv is not None:
 */
    if (unlikely(__pyx_v_render_cache_d == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
      __PYX_ERR(0, 219, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_render_cache_d, __pyx_v_wh, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __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_6render_Render))))) __PYX_ERR(0, 219, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_rv, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":221
 *         rv = render_cache_d.get(wh, None)
 * 
 *         if rv is not None:             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
    __pyx_t_5 = (((PyObject *)__pyx_v_rv) != Py_None);
    __pyx_t_1 = (__pyx_t_5 != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":222
 * 
 *         if rv is not None:
 *             return rv             # <<<<<<<<<<<<<<
 * 
 *     else:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((PyObject *)__pyx_v_rv));
      __pyx_r = ((PyObject *)__pyx_v_rv);
      goto __pyx_L0;

      /* "renpy/display/render.pyx":221
 *         rv = render_cache_d.get(wh, None)
 * 
 *         if rv is not None:             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
    }

    /* "renpy/display/render.pyx":215
 *         height = 0
 * 
 *     if orig_width != width or orig_height != height:             # <<<<<<<<<<<<<<
 *         widtho = width
 *         heighto = height
 */
    goto __pyx_L12;
  }

  /* "renpy/display/render.pyx":225
 * 
 *     else:
 *         wh = orig_wh             # <<<<<<<<<<<<<<
 * 
 *     renpy.plog(2, "start render {!r}", d)
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_orig_wh);
    __pyx_v_wh = __pyx_v_orig_wh;
  }
  __pyx_L12:;

  /* "renpy/display/render.pyx":227
 *         wh = orig_wh
 * 
 *     renpy.plog(2, "start render {!r}", d)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_plog); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __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_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);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_int_2, __pyx_kp_s_start_render_r, __pyx_v_d};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __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_4)) {
    PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_int_2, __pyx_kp_s_start_render_r, __pyx_v_d};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_3) {
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_int_2);
    __Pyx_INCREF(__pyx_kp_s_start_render_r);
    __Pyx_GIVEREF(__pyx_kp_s_start_render_r);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_kp_s_start_render_r);
    __Pyx_INCREF(__pyx_v_d);
    __Pyx_GIVEREF(__pyx_v_d);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_d);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":229
 *     renpy.plog(2, "start render {!r}", d)
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         rendering += 1
 *         old_st = render_st
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":230
 * 
 *     try:
 *         rendering += 1             # <<<<<<<<<<<<<<
 *         old_st = render_st
 *         old_at = render_at
 */
    __pyx_v_5renpy_7display_6render_rendering = (__pyx_v_5renpy_7display_6render_rendering + 1);

    /* "renpy/display/render.pyx":231
 *     try:
 *         rendering += 1
 *         old_st = render_st             # <<<<<<<<<<<<<<
 *         old_at = render_at
 *         render_st = st
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_st); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_old_st = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":232
 *         rendering += 1
 *         old_st = render_st
 *         old_at = render_at             # <<<<<<<<<<<<<<
 *         render_st = st
 *         render_at = at
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_at); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_old_at = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":233
 *         old_st = render_st
 *         old_at = render_at
 *         render_st = st             # <<<<<<<<<<<<<<
 *         render_at = at
 *         rv = d.render(widtho, heighto, st, at)
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_st); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_st, __pyx_t_2) < 0) __PYX_ERR(0, 233, __pyx_L17_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":234
 *         old_at = render_at
 *         render_st = st
 *         render_at = at             # <<<<<<<<<<<<<<
 *         rv = d.render(widtho, heighto, st, at)
 *     finally:
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_at); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_at, __pyx_t_2) < 0) __PYX_ERR(0, 234, __pyx_L17_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":235
 *         render_st = st
 *         render_at = at
 *         rv = d.render(widtho, heighto, st, at)             # <<<<<<<<<<<<<<
 *     finally:
 *         rendering -= 1
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_render); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = PyFloat_FromDouble(__pyx_v_st); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 235, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_at); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_9);
        __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[5] = {__pyx_t_9, __pyx_v_widtho, __pyx_v_heighto, __pyx_t_7, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L17_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __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[5] = {__pyx_t_9, __pyx_v_widtho, __pyx_v_heighto, __pyx_t_7, __pyx_t_3};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L17_error)
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 235, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_9) {
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
      }
      __Pyx_INCREF(__pyx_v_widtho);
      __Pyx_GIVEREF(__pyx_v_widtho);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_8, __pyx_v_widtho);
      __Pyx_INCREF(__pyx_v_heighto);
      __Pyx_GIVEREF(__pyx_v_heighto);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_8, __pyx_v_heighto);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_8, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_8, __pyx_t_3);
      __pyx_t_7 = 0;
      __pyx_t_3 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L17_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5renpy_7display_6render_Render))))) __PYX_ERR(0, 235, __pyx_L17_error)
    __Pyx_DECREF_SET(__pyx_v_rv, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_2));
    __pyx_t_2 = 0;
  }

  /* "renpy/display/render.pyx":237
 *         rv = d.render(widtho, heighto, st, at)
 *     finally:
 *         rendering -= 1             # <<<<<<<<<<<<<<
 *         render_st = old_st
 *         render_at = old_at
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_v_5renpy_7display_6render_rendering = (__pyx_v_5renpy_7display_6render_rendering - 1);

      /* "renpy/display/render.pyx":238
 *     finally:
 *         rendering -= 1
 *         render_st = old_st             # <<<<<<<<<<<<<<
 *         render_at = old_at
 * 
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_st, __pyx_v_old_st) < 0) __PYX_ERR(0, 238, __pyx_L1_error)

      /* "renpy/display/render.pyx":239
 *         rendering -= 1
 *         render_st = old_st
 *         render_at = old_at             # <<<<<<<<<<<<<<
 * 
 *     if rv.__class__ is not Render:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_at, __pyx_v_old_at) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
      goto __pyx_L18;
    }
    __pyx_L17_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __pyx_t_8 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
      {

        /* "renpy/display/render.pyx":237
 *         rv = d.render(widtho, heighto, st, at)
 *     finally:
 *         rendering -= 1             # <<<<<<<<<<<<<<
 *         render_st = old_st
 *         render_at = old_at
 */
        __pyx_v_5renpy_7display_6render_rendering = (__pyx_v_5renpy_7display_6render_rendering - 1);

        /* "renpy/display/render.pyx":238
 *     finally:
 *         rendering -= 1
 *         render_st = old_st             # <<<<<<<<<<<<<<
 *         render_at = old_at
 * 
 */
        if (unlikely(!__pyx_v_old_st)) { __Pyx_RaiseUnboundLocalError("old_st"); __PYX_ERR(0, 238, __pyx_L20_error) }
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_st, __pyx_v_old_st) < 0) __PYX_ERR(0, 238, __pyx_L20_error)

        /* "renpy/display/render.pyx":239
 *         rendering -= 1
 *         render_st = old_st
 *         render_at = old_at             # <<<<<<<<<<<<<<
 * 
 *     if rv.__class__ is not Render:
 */
        if (unlikely(!__pyx_v_old_at)) { __Pyx_RaiseUnboundLocalError("old_at"); __PYX_ERR(0, 239, __pyx_L20_error) }
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_at, __pyx_v_old_at) < 0) __PYX_ERR(0, 239, __pyx_L20_error)
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
      goto __pyx_L1_error;
      __pyx_L20_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __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;
      __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L18:;
  }

  /* "renpy/display/render.pyx":241
 *         render_at = old_at
 * 
 *     if rv.__class__ is not Render:             # <<<<<<<<<<<<<<
 *         raise Exception("{!r}.render() must return a Render.".format(d))
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = (__pyx_t_2 != ((PyObject *)__pyx_ptype_5renpy_7display_6render_Render));
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":242
 * 
 *     if rv.__class__ is not Render:
 *         raise Exception("{!r}.render() must return a Render.".format(d))             # <<<<<<<<<<<<<<
 * 
 *     rv.render_of.append(d)
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_r_render_must_return_a_Render, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_d};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_v_d};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10); __pyx_t_10 = NULL;
        __Pyx_INCREF(__pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_d);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __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_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __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 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 242, __pyx_L1_error)

    /* "renpy/display/render.pyx":241
 *         render_at = old_at
 * 
 *     if rv.__class__ is not Render:             # <<<<<<<<<<<<<<
 *         raise Exception("{!r}.render() must return a Render.".format(d))
 * 
 */
  }

  /* "renpy/display/render.pyx":244
 *         raise Exception("{!r}.render() must return a Render.".format(d))
 * 
 *     rv.render_of.append(d)             # <<<<<<<<<<<<<<
 * 
 *     if d._clipping:
 */
  __pyx_t_19 = __Pyx_PyObject_Append(__pyx_v_rv->render_of, __pyx_v_d); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 244, __pyx_L1_error)

  /* "renpy/display/render.pyx":246
 *     rv.render_of.append(d)
 * 
 *     if d._clipping:             # <<<<<<<<<<<<<<
 *         renpy.plog(4, "before clipping")
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_clipping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 246, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":247
 * 
 *     if d._clipping:
 *         renpy.plog(4, "before clipping")             # <<<<<<<<<<<<<<
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_plog); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __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__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __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/display/render.pyx":248
 *     if d._clipping:
 *         renpy.plog(4, "before clipping")
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)             # <<<<<<<<<<<<<<
 *         rv.render_of.append(d)
 *         renpy.plog(4, "after clipping")
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_subsurface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_rv->width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_rv->height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = PyTuple_New(4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_3);
    __pyx_t_4 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_10);
    __pyx_t_10 = 0;
    __pyx_t_10 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_focus, Py_True) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5renpy_7display_6render_Render))))) __PYX_ERR(0, 248, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_rv, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":249
 *         renpy.plog(4, "before clipping")
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)             # <<<<<<<<<<<<<<
 *         renpy.plog(4, "after clipping")
 * 
 */
    __pyx_t_19 = __Pyx_PyObject_Append(__pyx_v_rv->render_of, __pyx_v_d); if (unlikely(__pyx_t_19 == ((int)-1))) __PYX_ERR(0, 249, __pyx_L1_error)

    /* "renpy/display/render.pyx":250
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)
 *         renpy.plog(4, "after clipping")             # <<<<<<<<<<<<<<
 * 
 *     render_cache_d[wh] = rv
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_plog); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":246
 *     rv.render_of.append(d)
 * 
 *     if d._clipping:             # <<<<<<<<<<<<<<
 *         renpy.plog(4, "before clipping")
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 */
  }

  /* "renpy/display/render.pyx":252
 *         renpy.plog(4, "after clipping")
 * 
 *     render_cache_d[wh] = rv             # <<<<<<<<<<<<<<
 * 
 *     if wh is not orig_wh:
 */
  if (unlikely(__pyx_v_render_cache_d == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 252, __pyx_L1_error)
  }
  if (unlikely(PyDict_SetItem(__pyx_v_render_cache_d, __pyx_v_wh, ((PyObject *)__pyx_v_rv)) < 0)) __PYX_ERR(0, 252, __pyx_L1_error)

  /* "renpy/display/render.pyx":254
 *     render_cache_d[wh] = rv
 * 
 *     if wh is not orig_wh:             # <<<<<<<<<<<<<<
 *         render_cache_d[orig_wh] = rv
 * 
 */
  __pyx_t_5 = (__pyx_v_wh != __pyx_v_orig_wh);
  __pyx_t_1 = (__pyx_t_5 != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":255
 * 
 *     if wh is not orig_wh:
 *         render_cache_d[orig_wh] = rv             # <<<<<<<<<<<<<<
 * 
 *     renpy.plog(2, "end render {!r}", d)
 */
    if (unlikely(__pyx_v_render_cache_d == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 255, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_render_cache_d, __pyx_v_orig_wh, ((PyObject *)__pyx_v_rv)) < 0)) __PYX_ERR(0, 255, __pyx_L1_error)

    /* "renpy/display/render.pyx":254
 *     render_cache_d[wh] = rv
 * 
 *     if wh is not orig_wh:             # <<<<<<<<<<<<<<
 *         render_cache_d[orig_wh] = rv
 * 
 */
  }

  /* "renpy/display/render.pyx":257
 *         render_cache_d[orig_wh] = rv
 * 
 *     renpy.plog(2, "end render {!r}", d)             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
  __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_plog); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 257, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __pyx_t_10 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_10)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_11 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_int_2, __pyx_kp_s_end_render_r, __pyx_v_d};
    __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_int_2, __pyx_kp_s_end_render_r, __pyx_v_d};
    __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_11, 3+__pyx_t_11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else
  #endif
  {
    __pyx_t_2 = PyTuple_New(3+__pyx_t_11); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__pyx_t_10) {
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_10); __pyx_t_10 = NULL;
    }
    __Pyx_INCREF(__pyx_int_2);
    __Pyx_GIVEREF(__pyx_int_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_11, __pyx_int_2);
    __Pyx_INCREF(__pyx_kp_s_end_render_r);
    __Pyx_GIVEREF(__pyx_kp_s_end_render_r);
    PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_11, __pyx_kp_s_end_render_r);
    __Pyx_INCREF(__pyx_v_d);
    __Pyx_GIVEREF(__pyx_v_d);
    PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_11, __pyx_v_d);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":259
 *     renpy.plog(2, "end render {!r}", d)
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def invalidate(d):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_rv));
  __pyx_r = ((PyObject *)__pyx_v_rv);
  goto __pyx_L0;

  /* "renpy/display/render.pyx":147
 *     render_is_ready = 1
 * 
 * cpdef render(d, object widtho, object heighto, double st, double at):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */

  /* 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_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("renpy.display.render.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_orig_wh);
  __Pyx_XDECREF(__pyx_v_wh);
  __Pyx_XDECREF(__pyx_v_render_cache_d);
  __Pyx_XDECREF((PyObject *)__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_id_d);
  __Pyx_XDECREF(__pyx_v_style);
  __Pyx_XDECREF(__pyx_v_xmaximum);
  __Pyx_XDECREF(__pyx_v_ymaximum);
  __Pyx_XDECREF(__pyx_v_old_st);
  __Pyx_XDECREF(__pyx_v_old_at);
  __Pyx_XDECREF(__pyx_v_widtho);
  __Pyx_XDECREF(__pyx_v_heighto);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_9render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_8render[] = "\n    :doc: udd_utility\n    :args: (d, width, height, st, at)\n\n    Causes a displayable to be rendered, and a renpy.Render object to\n    be returned.\n\n    `d`\n        The displayable to render.\n\n    `width`, `height`\n        The width and height available for the displayable to render into.\n\n    `st`, `at`\n        The shown and animation timebases.\n\n    Renders returned by this object may be cached, and should not be modified\n    once they have been retrieved.\n    ";
static PyObject *__pyx_pw_5renpy_7display_6render_9render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_widtho = 0;
  PyObject *__pyx_v_heighto = 0;
  double __pyx_v_st;
  double __pyx_v_at;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,&__pyx_n_s_widtho,&__pyx_n_s_heighto,&__pyx_n_s_st,&__pyx_n_s_at,0};
    PyObject* values[5] = {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  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_d)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_widtho)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 1); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_heighto)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 2); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_st)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 3); __PYX_ERR(0, 147, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_at)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 4); __PYX_ERR(0, 147, __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, 147, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      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);
    }
    __pyx_v_d = values[0];
    __pyx_v_widtho = values[1];
    __pyx_v_heighto = values[2];
    __pyx_v_st = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_st == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L3_error)
    __pyx_v_at = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_at == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 147, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_8render(__pyx_self, __pyx_v_d, __pyx_v_widtho, __pyx_v_heighto, __pyx_v_st, __pyx_v_at);

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

static PyObject *__pyx_pf_5renpy_7display_6render_8render(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d, PyObject *__pyx_v_widtho, PyObject *__pyx_v_heighto, double __pyx_v_st, double __pyx_v_at) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("render", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5renpy_7display_6render_render(__pyx_v_d, __pyx_v_widtho, __pyx_v_heighto, __pyx_v_st, __pyx_v_at, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __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.display.render.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":261
 *     return rv
 * 
 * def invalidate(d):             # <<<<<<<<<<<<<<
 *     """
 *     Removes d from the render cache. If we're not in a redraw, triggers
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_11invalidate(PyObject *__pyx_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_5renpy_7display_6render_10invalidate[] = "\n    Removes d from the render cache. If we're not in a redraw, triggers\n    a redraw to start.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_11invalidate = {"invalidate", (PyCFunction)__pyx_pw_5renpy_7display_6render_11invalidate, METH_O, __pyx_doc_5renpy_7display_6render_10invalidate};
static PyObject *__pyx_pw_5renpy_7display_6render_11invalidate(PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("invalidate (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_10invalidate(__pyx_self, ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_5renpy_7display_6render_10invalidate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_v_v = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("invalidate", 0);

  /* "renpy/display/render.pyx":267
 *     """
 * 
 *     for v in render_cache[id(d)].values():             # <<<<<<<<<<<<<<
 *         v.kill_cache()
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_d);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_4 = __pyx_t_1; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 267, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 267, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 267, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 267, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":268
 * 
 *     for v in render_cache[id(d)].values():
 *         v.kill_cache()             # <<<<<<<<<<<<<<
 * 
 *     if per_frame:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_kill_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 268, __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_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __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, 268, __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/display/render.pyx":267
 *     """
 * 
 *     for v in render_cache[id(d)].values():             # <<<<<<<<<<<<<<
 *         v.kill_cache()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":270
 *         v.kill_cache()
 * 
 *     if per_frame:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_per_frame); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":271
 * 
 *     if per_frame:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if not rendering:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":270
 *         v.kill_cache()
 * 
 *     if per_frame:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "renpy/display/render.pyx":273
 *         return
 * 
 *     if not rendering:             # <<<<<<<<<<<<<<
 *         redraw(d, 0)
 * 
 */
  __pyx_t_7 = ((!(__pyx_v_5renpy_7display_6render_rendering != 0)) != 0);
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":274
 * 
 *     if not rendering:
 *         redraw(d, 0)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_redraw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
        __pyx_t_8 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_d, __pyx_int_0};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_d, __pyx_int_0};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_8, __pyx_v_d);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_8, __pyx_int_0);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 274, __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_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":273
 *         return
 * 
 *     if not rendering:             # <<<<<<<<<<<<<<
 *         redraw(d, 0)
 * 
 */
  }

  /* "renpy/display/render.pyx":261
 *     return rv
 * 
 * def invalidate(d):             # <<<<<<<<<<<<<<
 *     """
 *     Removes d from the render cache. If we're not in a redraw, triggers
 */

  /* 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_AddTraceback("renpy.display.render.invalidate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":277
 * 
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Called to determine if any redraws are pending. Returns true if we
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_13process_redraws(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_12process_redraws[] = "\n    Called to determine if any redraws are pending. Returns true if we\n    need to redraw the screen now, false otherwise.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_13process_redraws = {"process_redraws", (PyCFunction)__pyx_pw_5renpy_7display_6render_13process_redraws, METH_NOARGS, __pyx_doc_5renpy_7display_6render_12process_redraws};
static PyObject *__pyx_pw_5renpy_7display_6render_13process_redraws(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("process_redraws (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_12process_redraws(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_12process_redraws(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_now = NULL;
  int __pyx_v_rv;
  PyObject *__pyx_v_new_redraw_queue = NULL;
  PyObject *__pyx_v_seen = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_when = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_id_d = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("process_redraws", 0);

  /* "renpy/display/render.pyx":285
 *     global redraw_queue
 * 
 *     redraw_queue.sort()             # <<<<<<<<<<<<<<
 * 
 *     now = renpy.display.core.get_time()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_sort); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __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, 285, __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, 285, __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/display/render.pyx":287
 *     redraw_queue.sort()
 * 
 *     now = renpy.display.core.get_time()             # <<<<<<<<<<<<<<
 *     rv = False
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __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_core); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __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_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __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, 287, __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, 287, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_now = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":288
 * 
 *     now = renpy.display.core.get_time()
 *     rv = False             # <<<<<<<<<<<<<<
 * 
 *     new_redraw_queue = [ ]
 */
  __pyx_v_rv = 0;

  /* "renpy/display/render.pyx":290
 *     rv = False
 * 
 *     new_redraw_queue = [ ]             # <<<<<<<<<<<<<<
 *     seen = set()
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_new_redraw_queue = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":291
 * 
 *     new_redraw_queue = [ ]
 *     seen = set()             # <<<<<<<<<<<<<<
 * 
 *     for t in redraw_queue:
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_seen = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":293
 *     seen = set()
 * 
 *     for t in redraw_queue:             # <<<<<<<<<<<<<<
 *         when, d = t
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 293, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (likely(!__pyx_t_5)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 293, __pyx_L1_error)
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 293, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":294
 * 
 *     for t in redraw_queue:
 *         when, d = t             # <<<<<<<<<<<<<<
 * 
 *         id_d = id(d)
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_t))) || (PyList_CheckExact(__pyx_v_t))) {
      PyObject* sequence = __pyx_v_t;
      #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, 294, __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, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 294, __pyx_L1_error)
      __pyx_t_7 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_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, 294, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_when, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":296
 *         when, d = t
 * 
 *         id_d = id(d)             # <<<<<<<<<<<<<<
 * 
 *         if id_d in seen:
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_d);
    __Pyx_GIVEREF(__pyx_v_d);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_d);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_id_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":298
 *         id_d = id(d)
 * 
 *         if id_d in seen:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_id_d, __pyx_v_seen, Py_EQ)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 298, __pyx_L1_error)
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "renpy/display/render.pyx":299
 * 
 *         if id_d in seen:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         seen.add(id_d)
 */
      goto __pyx_L3_continue;

      /* "renpy/display/render.pyx":298
 *         id_d = id(d)
 * 
 *         if id_d in seen:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    }

    /* "renpy/display/render.pyx":301
 *             continue
 * 
 *         seen.add(id_d)             # <<<<<<<<<<<<<<
 * 
 *         if id_d not in render_cache:
 */
    __pyx_t_10 = PySet_Add(__pyx_v_seen, __pyx_v_id_d); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 301, __pyx_L1_error)

    /* "renpy/display/render.pyx":303
 *         seen.add(id_d)
 * 
 *         if id_d not in render_cache:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_id_d, __pyx_t_1, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 303, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = (__pyx_t_9 != 0);
    if (__pyx_t_8) {

      /* "renpy/display/render.pyx":304
 * 
 *         if id_d not in render_cache:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if when <= now:
 */
      goto __pyx_L3_continue;

      /* "renpy/display/render.pyx":303
 *         seen.add(id_d)
 * 
 *         if id_d not in render_cache:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    }

    /* "renpy/display/render.pyx":306
 *             continue
 * 
 *         if when <= now:             # <<<<<<<<<<<<<<
 * 
 *             # Remove this displayable and all its parents from the
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_when, __pyx_v_now, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "renpy/display/render.pyx":312
 *             # children that we want to reuse.
 * 
 *             for v in render_cache[id_d].values():             # <<<<<<<<<<<<<<
 *                 v.kill_cache()
 * 
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyObject_GetItem(__pyx_t_3, __pyx_v_id_d); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 312, __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_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_11 = 0;
        __pyx_t_12 = NULL;
      } else {
        __pyx_t_11 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 312, __pyx_L1_error)
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (likely(!__pyx_t_12)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 312, __pyx_L1_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          } else {
            if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_1); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 312, __pyx_L1_error)
            #else
            __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_1);
            #endif
          }
        } else {
          __pyx_t_1 = __pyx_t_12(__pyx_t_3);
          if (unlikely(!__pyx_t_1)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
              else __PYX_ERR(0, 312, __pyx_L1_error)
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
        __pyx_t_1 = 0;

        /* "renpy/display/render.pyx":313
 * 
 *             for v in render_cache[id_d].values():
 *                 v.kill_cache()             # <<<<<<<<<<<<<<
 * 
 *             rv = True
 */
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_kill_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 313, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_13 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        if (__pyx_t_13) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_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/display/render.pyx":312
 *             # children that we want to reuse.
 * 
 *             for v in render_cache[id_d].values():             # <<<<<<<<<<<<<<
 *                 v.kill_cache()
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "renpy/display/render.pyx":315
 *                 v.kill_cache()
 * 
 *             rv = True             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __pyx_v_rv = 1;

      /* "renpy/display/render.pyx":306
 *             continue
 * 
 *         if when <= now:             # <<<<<<<<<<<<<<
 * 
 *             # Remove this displayable and all its parents from the
 */
      goto __pyx_L9;
    }

    /* "renpy/display/render.pyx":318
 * 
 *         else:
 *             new_redraw_queue.append(t)             # <<<<<<<<<<<<<<
 * 
 *     redraw_queue = new_redraw_queue
 */
    /*else*/ {
      __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_new_redraw_queue, __pyx_v_t); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 318, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "renpy/display/render.pyx":293
 *     seen = set()
 * 
 *     for t in redraw_queue:             # <<<<<<<<<<<<<<
 *         when, d = t
 * 
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":320
 *             new_redraw_queue.append(t)
 * 
 *     redraw_queue = new_redraw_queue             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_redraw_queue, __pyx_v_new_redraw_queue) < 0) __PYX_ERR(0, 320, __pyx_L1_error)

  /* "renpy/display/render.pyx":322
 *     redraw_queue = new_redraw_queue
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_rv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":277
 * 
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Called to determine if any redraws are pending. Returns true if we
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("renpy.display.render.process_redraws", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_now);
  __Pyx_XDECREF(__pyx_v_new_redraw_queue);
  __Pyx_XDECREF(__pyx_v_seen);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_when);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_id_d);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":325
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_15redraw_time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_14redraw_time[] = "\n    Returns the time at which the next redraw is scheduled.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_15redraw_time = {"redraw_time", (PyCFunction)__pyx_pw_5renpy_7display_6render_15redraw_time, METH_NOARGS, __pyx_doc_5renpy_7display_6render_14redraw_time};
static PyObject *__pyx_pw_5renpy_7display_6render_15redraw_time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("redraw_time (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_14redraw_time(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_14redraw_time(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("redraw_time", 0);

  /* "renpy/display/render.pyx":330
 *     """
 * 
 *     if redraw_queue:             # <<<<<<<<<<<<<<
 *         return redraw_queue[0][0]
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 330, __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, 330, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":331
 * 
 *     if redraw_queue:
 *         return redraw_queue[0][0]             # <<<<<<<<<<<<<<
 * 
 *     return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":330
 *     """
 * 
 *     if redraw_queue:             # <<<<<<<<<<<<<<
 *         return redraw_queue[0][0]
 * 
 */
  }

  /* "renpy/display/render.pyx":333
 *         return redraw_queue[0][0]
 * 
 *     return None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_None);
  __pyx_r = Py_None;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":325
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.display.render.redraw_time", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":336
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_17redraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_16redraw[] = "\n    :doc: udd_utility\n\n    Causes the displayable `d` to be redrawn after `when` seconds have\n    elapsed.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_17redraw = {"redraw", (PyCFunction)__pyx_pw_5renpy_7display_6render_17redraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_16redraw};
static PyObject *__pyx_pw_5renpy_7display_6render_17redraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_when = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("redraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,&__pyx_n_s_when,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_d)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_when)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("redraw", 1, 2, 2, 1); __PYX_ERR(0, 336, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "redraw") < 0)) __PYX_ERR(0, 336, __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_d = values[0];
    __pyx_v_when = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("redraw", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 336, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_16redraw(__pyx_self, __pyx_v_d, __pyx_v_when);

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

static PyObject *__pyx_pf_5renpy_7display_6render_16redraw(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d, PyObject *__pyx_v_when) {
  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;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("redraw", 0);

  /* "renpy/display/render.pyx":344
 *     """
 * 
 *     if not renpy.game.interface:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __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, 344, __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_interface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 344, __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, 344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":345
 * 
 *     if not renpy.game.interface:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     if per_frame:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":344
 *     """
 * 
 *     if not renpy.game.interface:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "renpy/display/render.pyx":347
 *         return
 * 
 *     if per_frame:             # <<<<<<<<<<<<<<
 *         invalidate(d)
 *         return
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_per_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 347, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":348
 * 
 *     if per_frame:
 *         invalidate(d)             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_invalidate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __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_5, __pyx_v_d};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __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[2] = {__pyx_t_5, __pyx_v_d};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 348, __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_INCREF(__pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_d);
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __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;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":349
 *     if per_frame:
 *         invalidate(d)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     redraw_queue.append((when + renpy.game.interface.frame_time, d))
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":347
 *         return
 * 
 *     if per_frame:             # <<<<<<<<<<<<<<
 *         invalidate(d)
 *         return
 */
  }

  /* "renpy/display/render.pyx":351
 *         return
 * 
 *     redraw_queue.append((when + renpy.game.interface.frame_time, d))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_game); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __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_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_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_frame_time); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_v_when, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_d);
  __pyx_t_2 = 0;
  __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_6); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 351, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "renpy/display/render.pyx":336
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */

  /* 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_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.display.render.redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":360
 *     """
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         return dict(
 *             xdx = self.xdx,
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_1__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_1__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D___getstate__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D___getstate__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getstate__", 0);

  /* "renpy/display/render.pyx":361
 * 
 *     def __getstate__(self):
 *         return dict(             # <<<<<<<<<<<<<<
 *             xdx = self.xdx,
 *             xdy = self.xdy,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "renpy/display/render.pyx":362
 *     def __getstate__(self):
 *         return dict(
 *             xdx = self.xdx,             # <<<<<<<<<<<<<<
 *             xdy = self.xdy,
 *             ydx = self.ydx,
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->xdx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_xdx, __pyx_t_2) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":363
 *         return dict(
 *             xdx = self.xdx,
 *             xdy = self.xdy,             # <<<<<<<<<<<<<<
 *             ydx = self.ydx,
 *             ydy = self.ydy)
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->xdy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_xdy, __pyx_t_2) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":364
 *             xdx = self.xdx,
 *             xdy = self.xdy,
 *             ydx = self.ydx,             # <<<<<<<<<<<<<<
 *             ydy = self.ydy)
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->ydx); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ydx, __pyx_t_2) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":365
 *             xdy = self.xdy,
 *             ydx = self.ydx,
 *             ydy = self.ydy)             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, state):
 */
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->ydy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_ydy, __pyx_t_2) < 0) __PYX_ERR(0, 362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":360
 *     """
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         return dict(
 *             xdx = self.xdx,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":367
 *             ydy = self.ydy)
 * 
 *     def __setstate__(self, state):             # <<<<<<<<<<<<<<
 *         self.xdx = state['xdx']
 *         self.xdy = state['xdy']
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_2__setstate__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), ((PyObject *)__pyx_v_state));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_2__setstate__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "renpy/display/render.pyx":368
 * 
 *     def __setstate__(self, state):
 *         self.xdx = state['xdx']             # <<<<<<<<<<<<<<
 *         self.xdy = state['xdy']
 *         self.ydx = state['ydx']
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_s_xdx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 368, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->xdx = __pyx_t_2;

  /* "renpy/display/render.pyx":369
 *     def __setstate__(self, state):
 *         self.xdx = state['xdx']
 *         self.xdy = state['xdy']             # <<<<<<<<<<<<<<
 *         self.ydx = state['ydx']
 *         self.ydy = state['ydy']
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_s_xdy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 369, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->xdy = __pyx_t_2;

  /* "renpy/display/render.pyx":370
 *         self.xdx = state['xdx']
 *         self.xdy = state['xdy']
 *         self.ydx = state['ydx']             # <<<<<<<<<<<<<<
 *         self.ydy = state['ydy']
 * 
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_s_ydx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 370, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->ydx = __pyx_t_2;

  /* "renpy/display/render.pyx":371
 *         self.xdy = state['xdy']
 *         self.ydx = state['ydx']
 *         self.ydy = state['ydy']             # <<<<<<<<<<<<<<
 * 
 *     def __init__(Matrix2D self, double xdx, double xdy, double ydx, double ydy):
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_s_ydy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->ydy = __pyx_t_2;

  /* "renpy/display/render.pyx":367
 *             ydy = self.ydy)
 * 
 *     def __setstate__(self, state):             # <<<<<<<<<<<<<<
 *         self.xdx = state['xdx']
 *         self.xdy = state['xdy']
 */

  /* 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.display.render.Matrix2D.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":373
 *         self.ydy = state['ydy']
 * 
 *     def __init__(Matrix2D self, double xdx, double xdy, double ydx, double ydy):             # <<<<<<<<<<<<<<
 *         self.xdx = xdx
 *         self.xdy = xdy
 */

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_8Matrix2D_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5renpy_7display_6render_8Matrix2D_5__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_xdx;
  double __pyx_v_xdy;
  double __pyx_v_ydx;
  double __pyx_v_ydy;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xdx,&__pyx_n_s_xdy,&__pyx_n_s_ydx,&__pyx_n_s_ydy,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_xdx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_xdy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 373, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ydx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 373, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ydy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 373, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 373, __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_xdx = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_xdx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 373, __pyx_L3_error)
    __pyx_v_xdy = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_xdy == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 373, __pyx_L3_error)
    __pyx_v_ydx = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_ydx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 373, __pyx_L3_error)
    __pyx_v_ydy = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_ydy == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 373, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 373, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_4__init__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), __pyx_v_xdx, __pyx_v_xdy, __pyx_v_ydx, __pyx_v_ydy);

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_4__init__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, double __pyx_v_xdx, double __pyx_v_xdy, double __pyx_v_ydx, double __pyx_v_ydy) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "renpy/display/render.pyx":374
 * 
 *     def __init__(Matrix2D self, double xdx, double xdy, double ydx, double ydy):
 *         self.xdx = xdx             # <<<<<<<<<<<<<<
 *         self.xdy = xdy
 *         self.ydx = ydx
 */
  __pyx_v_self->xdx = __pyx_v_xdx;

  /* "renpy/display/render.pyx":375
 *     def __init__(Matrix2D self, double xdx, double xdy, double ydx, double ydy):
 *         self.xdx = xdx
 *         self.xdy = xdy             # <<<<<<<<<<<<<<
 *         self.ydx = ydx
 *         self.ydy = ydy
 */
  __pyx_v_self->xdy = __pyx_v_xdy;

  /* "renpy/display/render.pyx":376
 *         self.xdx = xdx
 *         self.xdy = xdy
 *         self.ydx = ydx             # <<<<<<<<<<<<<<
 *         self.ydy = ydy
 * 
 */
  __pyx_v_self->ydx = __pyx_v_ydx;

  /* "renpy/display/render.pyx":377
 *         self.xdy = xdy
 *         self.ydx = ydx
 *         self.ydy = ydy             # <<<<<<<<<<<<<<
 * 
 *     cpdef tuple transform(Matrix2D self, double x, double y):
 */
  __pyx_v_self->ydy = __pyx_v_ydy;

  /* "renpy/display/render.pyx":373
 *         self.ydy = state['ydy']
 * 
 *     def __init__(Matrix2D self, double xdx, double xdy, double ydx, double ydy):             # <<<<<<<<<<<<<<
 *         self.xdx = xdx
 *         self.xdy = xdy
 */

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

/* "renpy/display/render.pyx":379
 *         self.ydy = ydy
 * 
 *     cpdef tuple transform(Matrix2D self, double x, double y):             # <<<<<<<<<<<<<<
 *         return (x * self.xdx + y * self.xdy), (x * self.ydx + y * self.ydy)
 * 
 */

static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_7transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5renpy_7display_6render_8Matrix2D_transform(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, 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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("transform", 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_transform); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_7transform)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL;
      __pyx_t_7 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(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_7 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __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;
        __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[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __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;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else
      #endif
      {
        __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 379, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (__pyx_t_6) {
          __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_3);
        PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4);
        __pyx_t_3 = 0;
        __pyx_t_4 = 0;
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 379, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 379, __pyx_L1_error)
      __pyx_r = ((PyObject*)__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/display/render.pyx":380
 * 
 *     cpdef tuple transform(Matrix2D self, double x, double y):
 *         return (x * self.xdx + y * self.xdy), (x * self.ydx + y * self.ydy)             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(Matrix2D self, Matrix2D other):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":379
 *         self.ydy = ydy
 * 
 *     cpdef tuple transform(Matrix2D self, double x, double y):             # <<<<<<<<<<<<<<
 *         return (x * self.xdx + y * self.xdy), (x * self.ydx + y * self.ydy)
 * 
 */

  /* 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_8);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.transform", __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_7display_6render_8Matrix2D_7transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_7transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_x;
  double __pyx_v_y;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transform (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("transform", 1, 2, 2, 1); __PYX_ERR(0, 379, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) __PYX_ERR(0, 379, __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 = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L3_error)
    __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L3_error)
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 379, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_6transform(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_6transform(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, double __pyx_v_x, double __pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("transform", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5renpy_7display_6render_8Matrix2D_transform(__pyx_v_self, __pyx_v_x, __pyx_v_y, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __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.display.render.Matrix2D.transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":382
 *         return (x * self.xdx + y * self.xdy), (x * self.ydx + y * self.ydy)
 * 
 *     def __mul__(Matrix2D self, Matrix2D other):             # <<<<<<<<<<<<<<
 *         return Matrix2D(
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_9__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_9__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_5renpy_7display_6render_Matrix2D, 1, "self", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5renpy_7display_6render_Matrix2D, 1, "other", 0))) __PYX_ERR(0, 382, __pyx_L1_error)
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_8__mul__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_8__mul__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_other) {
  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("__mul__", 0);

  /* "renpy/display/render.pyx":383
 * 
 *     def __mul__(Matrix2D self, Matrix2D other):
 *         return Matrix2D(             # <<<<<<<<<<<<<<
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 */
  __Pyx_XDECREF(__pyx_r);

  /* "renpy/display/render.pyx":384
 *     def __mul__(Matrix2D self, Matrix2D other):
 *         return Matrix2D(
 *             other.xdx * self.xdx + other.xdy * self.ydx,             # <<<<<<<<<<<<<<
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 *             other.ydx * self.xdx + other.ydy * self.ydx,
 */
  __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_other->xdx * __pyx_v_self->xdx) + (__pyx_v_other->xdy * __pyx_v_self->ydx))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "renpy/display/render.pyx":385
 *         return Matrix2D(
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 *             other.xdx * self.xdy + other.xdy * self.ydy,             # <<<<<<<<<<<<<<
 *             other.ydx * self.xdx + other.ydy * self.ydx,
 *             other.ydx * self.xdy + other.ydy * self.ydy)
 */
  __pyx_t_2 = PyFloat_FromDouble(((__pyx_v_other->xdx * __pyx_v_self->xdy) + (__pyx_v_other->xdy * __pyx_v_self->ydy))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 385, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "renpy/display/render.pyx":386
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 *             other.ydx * self.xdx + other.ydy * self.ydx,             # <<<<<<<<<<<<<<
 *             other.ydx * self.xdy + other.ydy * self.ydy)
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_other->ydx * __pyx_v_self->xdx) + (__pyx_v_other->ydy * __pyx_v_self->ydx))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "renpy/display/render.pyx":387
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 *             other.ydx * self.xdx + other.ydy * self.ydx,
 *             other.ydx * self.xdy + other.ydy * self.ydy)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_t_4 = PyFloat_FromDouble(((__pyx_v_other->ydx * __pyx_v_self->xdy) + (__pyx_v_other->ydy * __pyx_v_self->ydy))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "renpy/display/render.pyx":383
 * 
 *     def __mul__(Matrix2D self, Matrix2D other):
 *         return Matrix2D(             # <<<<<<<<<<<<<<
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 */
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6render_Matrix2D), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":382
 *         return (x * self.xdx + y * self.xdy), (x * self.ydx + y * self.ydy)
 * 
 *     def __mul__(Matrix2D self, Matrix2D other):             # <<<<<<<<<<<<<<
 *         return Matrix2D(
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 */

  /* 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.display.render.Matrix2D.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":389
 *             other.ydx * self.xdy + other.ydy * self.ydy)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_11__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_11__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_10__repr__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_10__repr__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self) {
  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("__repr__", 0);

  /* "renpy/display/render.pyx":390
 * 
 *     def __repr__(self):
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(self, other, op):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xdx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->xdy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->ydx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->ydy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Matrix2D_xdx_f_xdy_f_ydx_f_ydy_f, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":389
 *             other.ydx * self.xdy + other.ydy * self.ydy)
 * 
 *     def __repr__(self):             # <<<<<<<<<<<<<<
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)
 * 
 */

  /* 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.display.render.Matrix2D.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":392
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)
 * 
 *     def __richcmp__(self, other, op):             # <<<<<<<<<<<<<<
 * 
 *         if op != 2:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_13__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_op); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_13__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_op) {
  PyObject *__pyx_v_op = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_v_op = __Pyx_PyInt_From_int(__pyx_arg_op); if (unlikely(!__pyx_v_op)) __PYX_ERR(0, 392, __pyx_L3_error)
  __Pyx_GOTREF(__pyx_v_op);
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_12__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_op));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_12__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_op) {
  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;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("__richcmp__", 0);

  /* "renpy/display/render.pyx":394
 *     def __richcmp__(self, other, op):
 * 
 *         if op != 2:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_op, __pyx_int_2, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 394, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 394, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":395
 * 
 *         if op != 2:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *         if self is other:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":394
 *     def __richcmp__(self, other, op):
 * 
 *         if op != 2:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
 */
  }

  /* "renpy/display/render.pyx":397
 *             return NotImplemented
 * 
 *         if self is other:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_2 = (__pyx_v_self == __pyx_v_other);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":398
 * 
 *         if self is other:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         return (
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":397
 *             return NotImplemented
 * 
 *         if self is other:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "renpy/display/render.pyx":400
 *             return True
 * 
 *         return (             # <<<<<<<<<<<<<<
 *             abs(self.xdx - other.xdx) +
 *             abs(self.xdy - other.xdy) +
 */
  __Pyx_XDECREF(__pyx_r);

  /* "renpy/display/render.pyx":401
 * 
 *         return (
 *             abs(self.xdx - other.xdx) +             # <<<<<<<<<<<<<<
 *             abs(self.xdy - other.xdy) +
 *             abs(self.ydx - other.ydx) +
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_xdx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_xdx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/display/render.pyx":402
 *         return (
 *             abs(self.xdx - other.xdx) +
 *             abs(self.xdy - other.xdy) +             # <<<<<<<<<<<<<<
 *             abs(self.ydx - other.ydx) +
 *             abs(self.ydy - other.ydy)) < .00001
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_xdy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_xdy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Subtract(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Absolute(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

  /* "renpy/display/render.pyx":401
 * 
 *         return (
 *             abs(self.xdx - other.xdx) +             # <<<<<<<<<<<<<<
 *             abs(self.xdy - other.xdy) +
 *             abs(self.ydx - other.ydx) +
 */
  __pyx_t_6 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":403
 *             abs(self.xdx - other.xdx) +
 *             abs(self.xdy - other.xdy) +
 *             abs(self.ydx - other.ydx) +             # <<<<<<<<<<<<<<
 *             abs(self.ydy - other.ydy)) < .00001
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ydx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_ydx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Absolute(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/display/render.pyx":402
 *         return (
 *             abs(self.xdx - other.xdx) +
 *             abs(self.xdy - other.xdy) +             # <<<<<<<<<<<<<<
 *             abs(self.ydx - other.ydx) +
 *             abs(self.ydy - other.ydy)) < .00001
 */
  __pyx_t_5 = PyNumber_Add(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 402, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":404
 *             abs(self.xdy - other.xdy) +
 *             abs(self.ydx - other.ydx) +
 *             abs(self.ydy - other.ydy)) < .00001             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint is_unit_aligned(Matrix2D self):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ydy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_ydy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Subtract(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyNumber_Absolute(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":403
 *             abs(self.xdx - other.xdx) +
 *             abs(self.xdy - other.xdy) +
 *             abs(self.ydx - other.ydx) +             # <<<<<<<<<<<<<<
 *             abs(self.ydy - other.ydy)) < .00001
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_float__00001, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":392
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)
 * 
 *     def __richcmp__(self, other, op):             # <<<<<<<<<<<<<<
 * 
 *         if op != 2:
 */

  /* 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.display.render.Matrix2D.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":406
 *             abs(self.ydy - other.ydy)) < .00001
 * 
 *     cpdef bint is_unit_aligned(Matrix2D self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if exactly one of abs(xdx) or abs(xdy) is 1.0, and
 */

static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_15is_unit_aligned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static int __pyx_f_5renpy_7display_6render_8Matrix2D_is_unit_aligned(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, int __pyx_skip_dispatch) {
  int __pyx_v_unit_xdx;
  int __pyx_v_unit_xdy;
  int __pyx_v_unit_ydx;
  int __pyx_v_unit_ydy;
  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;
  int __pyx_t_5;
  double __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("is_unit_aligned", 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_is_unit_aligned); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_15is_unit_aligned)) {
      __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_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __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, 406, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":416
 *         """
 * 
 *         cdef bint unit_xdx = .99999 < abs(self.xdx) < 1.00001             # <<<<<<<<<<<<<<
 *         cdef bint unit_xdy = .99999 < abs(self.xdy) < 1.00001
 *         cdef bint unit_ydx = .99999 < abs(self.ydx) < 1.00001
 */
  __pyx_t_6 = fabs(__pyx_v_self->xdx);
  __pyx_t_5 = (.99999 < __pyx_t_6);
  if (__pyx_t_5) {
    __pyx_t_5 = (__pyx_t_6 < 1.00001);
  }
  __pyx_v_unit_xdx = __pyx_t_5;

  /* "renpy/display/render.pyx":417
 * 
 *         cdef bint unit_xdx = .99999 < abs(self.xdx) < 1.00001
 *         cdef bint unit_xdy = .99999 < abs(self.xdy) < 1.00001             # <<<<<<<<<<<<<<
 *         cdef bint unit_ydx = .99999 < abs(self.ydx) < 1.00001
 *         cdef bint unit_ydy = .99999 < abs(self.ydy) < 1.00001
 */
  __pyx_t_6 = fabs(__pyx_v_self->xdy);
  __pyx_t_5 = (.99999 < __pyx_t_6);
  if (__pyx_t_5) {
    __pyx_t_5 = (__pyx_t_6 < 1.00001);
  }
  __pyx_v_unit_xdy = __pyx_t_5;

  /* "renpy/display/render.pyx":418
 *         cdef bint unit_xdx = .99999 < abs(self.xdx) < 1.00001
 *         cdef bint unit_xdy = .99999 < abs(self.xdy) < 1.00001
 *         cdef bint unit_ydx = .99999 < abs(self.ydx) < 1.00001             # <<<<<<<<<<<<<<
 *         cdef bint unit_ydy = .99999 < abs(self.ydy) < 1.00001
 * 
 */
  __pyx_t_6 = fabs(__pyx_v_self->ydx);
  __pyx_t_5 = (.99999 < __pyx_t_6);
  if (__pyx_t_5) {
    __pyx_t_5 = (__pyx_t_6 < 1.00001);
  }
  __pyx_v_unit_ydx = __pyx_t_5;

  /* "renpy/display/render.pyx":419
 *         cdef bint unit_xdy = .99999 < abs(self.xdy) < 1.00001
 *         cdef bint unit_ydx = .99999 < abs(self.ydx) < 1.00001
 *         cdef bint unit_ydy = .99999 < abs(self.ydy) < 1.00001             # <<<<<<<<<<<<<<
 * 
 *         return (unit_xdx ^ unit_xdy) and (unit_ydx ^ unit_ydy)
 */
  __pyx_t_6 = fabs(__pyx_v_self->ydy);
  __pyx_t_5 = (.99999 < __pyx_t_6);
  if (__pyx_t_5) {
    __pyx_t_5 = (__pyx_t_6 < 1.00001);
  }
  __pyx_v_unit_ydy = __pyx_t_5;

  /* "renpy/display/render.pyx":421
 *         cdef bint unit_ydy = .99999 < abs(self.ydy) < 1.00001
 * 
 *         return (unit_xdx ^ unit_xdy) and (unit_ydx ^ unit_ydy)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_7 = ((__pyx_v_unit_xdx ^ __pyx_v_unit_xdy) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_5 = __pyx_t_7;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_7 = ((__pyx_v_unit_ydx ^ __pyx_v_unit_ydy) != 0);
  __pyx_t_5 = __pyx_t_7;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_5;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":406
 *             abs(self.ydy - other.ydy)) < .00001
 * 
 *     cpdef bint is_unit_aligned(Matrix2D self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if exactly one of abs(xdx) or abs(xdy) is 1.0, and
 */

  /* 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_WriteUnraisable("renpy.display.render.Matrix2D.is_unit_aligned", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_15is_unit_aligned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_8Matrix2D_14is_unit_aligned[] = "\n        Returns true if exactly one of abs(xdx) or abs(xdy) is 1.0, and\n        the same for xdy and ydy. This is intended to report if a matrix\n        is aligned to the axes.\n\n        (It will also return true for something like xdx=1, xdy=0, ydx=1, xdy=1,\n        but that should never happen.)\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_15is_unit_aligned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_unit_aligned (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_14is_unit_aligned(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_14is_unit_aligned(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("is_unit_aligned", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_5renpy_7display_6render_8Matrix2D_is_unit_aligned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __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.display.render.Matrix2D.is_unit_aligned", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":23
 * 
 * cdef class Matrix2D:
 *     cdef public double xdx             # <<<<<<<<<<<<<<
 *     cdef public double xdy
 *     cdef public double ydx
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3xdx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3xdx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__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 = PyFloat_FromDouble(__pyx_v_self->xdx); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 23, __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.display.render.Matrix2D.xdx.__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_7display_6render_8Matrix2D_3xdx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_8Matrix2D_3xdx_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_7display_6render_8Matrix2D_3xdx_2__set__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 23, __pyx_L1_error)
  __pyx_v_self->xdx = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.xdx.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":24
 * cdef class Matrix2D:
 *     cdef public double xdx
 *     cdef public double xdy             # <<<<<<<<<<<<<<
 *     cdef public double ydx
 *     cdef public double ydy
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3xdy_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3xdy_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__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 = PyFloat_FromDouble(__pyx_v_self->xdy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 24, __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.display.render.Matrix2D.xdy.__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_7display_6render_8Matrix2D_3xdy_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_8Matrix2D_3xdy_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_7display_6render_8Matrix2D_3xdy_2__set__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 24, __pyx_L1_error)
  __pyx_v_self->xdy = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.xdy.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":25
 *     cdef public double xdx
 *     cdef public double xdy
 *     cdef public double ydx             # <<<<<<<<<<<<<<
 *     cdef public double ydy
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3ydx_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3ydx_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__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 = PyFloat_FromDouble(__pyx_v_self->ydx); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 25, __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.display.render.Matrix2D.ydx.__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_7display_6render_8Matrix2D_3ydx_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_8Matrix2D_3ydx_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_7display_6render_8Matrix2D_3ydx_2__set__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error)
  __pyx_v_self->ydx = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.ydx.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":26
 *     cdef public double xdy
 *     cdef public double ydx
 *     cdef public double ydy             # <<<<<<<<<<<<<<
 * 
 *     cpdef tuple transform(Matrix2D self, double x, double y)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3ydy_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_3ydy_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__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 = PyFloat_FromDouble(__pyx_v_self->ydy); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __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.display.render.Matrix2D.ydy.__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_7display_6render_8Matrix2D_3ydy_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_8Matrix2D_3ydy_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_7display_6render_8Matrix2D_3ydy_2__set__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy_2__set__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 26, __pyx_L1_error)
  __pyx_v_self->ydy = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.ydy.__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.xdx, self.xdy, self.ydx, self.ydy)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_17__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_17__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_7display_6render_8Matrix2D_16__reduce_cython__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_16__reduce_cython__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__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;
  int __pyx_t_6;
  int __pyx_t_7;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     cdef bint use_setstate
 *     state = (self.xdx, self.xdy, self.ydx, self.ydy)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xdx); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->xdy); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->ydx); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->ydy); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_v_state = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "(tree fragment)":4
 *     cdef bint use_setstate
 *     state = (self.xdx, self.xdy, self.ydx, self.ydy)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_5 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_v__dict = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "(tree fragment)":5
 *     state = (self.xdx, self.xdy, self.ydx, self.ydy)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_6 = (__pyx_v__dict != Py_None);
  __pyx_t_7 = (__pyx_t_6 != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":6
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v__dict);
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, __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 = (self.xdx, self.xdy, self.ydx, self.ydy)
 *     _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_Matrix2D, (type(self), 0x3190674, None), state
 */
  /*else*/ {
    __pyx_v_use_setstate = 0;
  }
  __pyx_L3:;

  /* "(tree fragment)":10
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Matrix2D, (type(self), 0x3190674, None), state
 *     else:
 */
  __pyx_t_7 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_7) {

    /* "(tree fragment)":11
 *         use_setstate = False
 *     if use_setstate:
 *         return __pyx_unpickle_Matrix2D, (type(self), 0x3190674, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Matrix2D, (type(self), 0x3190674, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Matrix2D); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_51971700);
    __Pyx_GIVEREF(__pyx_int_51971700);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_51971700);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 2, Py_None);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":10
 *     else:
 *         use_setstate = False
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Matrix2D, (type(self), 0x3190674, None), state
 *     else:
 */
  }

  /* "(tree fragment)":13
 *         return __pyx_unpickle_Matrix2D, (type(self), 0x3190674, None), state
 *     else:
 *         return __pyx_unpickle_Matrix2D, (type(self), 0x3190674, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Matrix2D__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Matrix2D); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_51971700);
    __Pyx_GIVEREF(__pyx_int_51971700);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_51971700);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_5, 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_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 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 = (self.xdx, self.xdy, self.ydx, self.ydy)
 */

  /* 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.display.render.Matrix2D.__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_Matrix2D, (type(self), 0x3190674, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Matrix2D__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_19__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_8Matrix2D_19__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_7display_6render_8Matrix2D_18__setstate_cython__(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_18__setstate_cython__(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__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_Matrix2D, (type(self), 0x3190674, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Matrix2D__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_7display_6render___pyx_unpickle_Matrix2D__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_Matrix2D, (type(self), 0x3190674, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Matrix2D__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.display.render.Matrix2D.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":428
 * 
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_19take_focuses(PyObject *__pyx_self, PyObject *__pyx_v_focuses); /*proto*/
static char __pyx_doc_5renpy_7display_6render_18take_focuses[] = "\n    Adds a list of rectangular focus regions to the focuses list.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_19take_focuses = {"take_focuses", (PyCFunction)__pyx_pw_5renpy_7display_6render_19take_focuses, METH_O, __pyx_doc_5renpy_7display_6render_18take_focuses};
static PyObject *__pyx_pw_5renpy_7display_6render_19take_focuses(PyObject *__pyx_self, PyObject *__pyx_v_focuses) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_focuses (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_18take_focuses(__pyx_self, ((PyObject *)__pyx_v_focuses));

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

static PyObject *__pyx_pf_5renpy_7display_6render_18take_focuses(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_focuses) {
  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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("take_focuses", 0);

  /* "renpy/display/render.pyx":433
 *     """
 * 
 *     screen_render.take_focuses(             # <<<<<<<<<<<<<<
 *         0, 0, screen_render.width, screen_render.height,
 *         IDENTITY,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_take_focuses); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":434
 * 
 *     screen_render.take_focuses(
 *         0, 0, screen_render.width, screen_render.height,             # <<<<<<<<<<<<<<
 *         IDENTITY,
 *         0, 0,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":435
 *     screen_render.take_focuses(
 *         0, 0, screen_render.width, screen_render.height,
 *         IDENTITY,             # <<<<<<<<<<<<<<
 *         0, 0,
 *         None,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "renpy/display/render.pyx":438
 *         0, 0,
 *         None,
 *         focuses)             # <<<<<<<<<<<<<<
 * 
 * # The result of focus_at_point for a modal render. This overrides any
 */
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[10] = {__pyx_t_6, __pyx_int_0, __pyx_int_0, __pyx_t_4, __pyx_t_5, __pyx_t_2, __pyx_int_0, __pyx_int_0, Py_None, __pyx_v_focuses};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 9+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __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;
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[10] = {__pyx_t_6, __pyx_int_0, __pyx_int_0, __pyx_t_4, __pyx_t_5, __pyx_t_2, __pyx_int_0, __pyx_int_0, Py_None, __pyx_v_focuses};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 9+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __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;
  } else
  #endif
  {
    __pyx_t_8 = PyTuple_New(9+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    if (__pyx_t_6) {
      __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
    }
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_t_2);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_8, 6+__pyx_t_7, __pyx_int_0);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_8, 7+__pyx_t_7, Py_None);
    __Pyx_INCREF(__pyx_v_focuses);
    __Pyx_GIVEREF(__pyx_v_focuses);
    PyTuple_SET_ITEM(__pyx_t_8, 8+__pyx_t_7, __pyx_v_focuses);
    __pyx_t_4 = 0;
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":428
 * 
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("renpy.display.render.take_focuses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":444
 * Modal = renpy.object.Sentinel("Modal")
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_21focus_at_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_20focus_at_point[] = "\n    Returns a focus object corresponding to the uppermost displayable\n    at point, or None if nothing focusable is at point.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_21focus_at_point = {"focus_at_point", (PyCFunction)__pyx_pw_5renpy_7display_6render_21focus_at_point, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_20focus_at_point};
static PyObject *__pyx_pw_5renpy_7display_6render_21focus_at_point(PyObject *__pyx_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("focus_at_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("focus_at_point", 1, 2, 2, 1); __PYX_ERR(0, 444, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "focus_at_point") < 0)) __PYX_ERR(0, 444, __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("focus_at_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 444, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.focus_at_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_20focus_at_point(__pyx_self, __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_5renpy_7display_6render_20focus_at_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_cf = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_screen = 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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  __Pyx_RefNannySetupContext("focus_at_point", 0);

  /* "renpy/display/render.pyx":450
 *     """
 * 
 *     if screen_render is None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 == Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":451
 * 
 *     if screen_render is None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cf = screen_render.focus_at_point(x, y, None)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":450
 *     """
 * 
 *     if screen_render is None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  }

  /* "renpy/display/render.pyx":453
 *         return None
 * 
 *     cf = screen_render.focus_at_point(x, y, None)             # <<<<<<<<<<<<<<
 *     if cf is None or cf is Modal:
 *         return None
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_focus_at_point); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 453, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_x, __pyx_v_y, Py_None};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __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[4] = {__pyx_t_4, __pyx_v_x, __pyx_v_y, Py_None};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 453, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_y);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, Py_None);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 453, __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_v_cf = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":454
 * 
 *     cf = screen_render.focus_at_point(x, y, None)
 *     if cf is None or cf is Modal:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_2 = (__pyx_v_cf == Py_None);
  __pyx_t_8 = (__pyx_t_2 != 0);
  if (!__pyx_t_8) {
  } else {
    __pyx_t_3 = __pyx_t_8;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_Modal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 454, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = (__pyx_v_cf == __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_8 != 0);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":455
 *     cf = screen_render.focus_at_point(x, y, None)
 *     if cf is None or cf is Modal:
 *         return None             # <<<<<<<<<<<<<<
 *     else:
 *         d, arg, screen = cf
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":454
 * 
 *     cf = screen_render.focus_at_point(x, y, None)
 *     if cf is None or cf is Modal:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  }

  /* "renpy/display/render.pyx":457
 *         return None
 *     else:
 *         d, arg, screen = cf             # <<<<<<<<<<<<<<
 *         return renpy.display.focus.Focus(d, arg, None, None, None, None, screen)
 * 
 */
  /*else*/ {
    if ((likely(PyTuple_CheckExact(__pyx_v_cf))) || (PyList_CheckExact(__pyx_v_cf))) {
      PyObject* sequence = __pyx_v_cf;
      #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, 457, __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_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_4 = PyObject_GetIter(__pyx_v_cf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 457, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = Py_TYPE(__pyx_t_4)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_5 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_7 = __pyx_t_9(__pyx_t_4); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_4), 3) < 0) __PYX_ERR(0, 457, __pyx_L1_error)
      __pyx_t_9 = 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_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 457, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __pyx_v_d = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_arg = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_screen = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "renpy/display/render.pyx":458
 *     else:
 *         d, arg, screen = cf
 *         return renpy.display.focus.Focus(d, arg, None, None, None, None, screen)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __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_focus); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __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_Focus); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __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_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);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_1)) {
      PyObject *__pyx_temp[8] = {__pyx_t_5, __pyx_v_d, __pyx_v_arg, Py_None, Py_None, Py_None, Py_None, __pyx_v_screen};
      __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 7+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 458, __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_1)) {
      PyObject *__pyx_temp[8] = {__pyx_t_5, __pyx_v_d, __pyx_v_arg, Py_None, Py_None, Py_None, Py_None, __pyx_v_screen};
      __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_6, 7+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_7);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(7+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __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(__pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_d);
      __Pyx_INCREF(__pyx_v_arg);
      __Pyx_GIVEREF(__pyx_v_arg);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_arg);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_6, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_6, Py_None);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_4, 5+__pyx_t_6, Py_None);
      __Pyx_INCREF(__pyx_v_screen);
      __Pyx_GIVEREF(__pyx_v_screen);
      PyTuple_SET_ITEM(__pyx_t_4, 6+__pyx_t_6, __pyx_v_screen);
      __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    goto __pyx_L0;
  }

  /* "renpy/display/render.pyx":444
 * Modal = renpy.object.Sentinel("Modal")
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */

  /* 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_7);
  __Pyx_AddTraceback("renpy.display.render.focus_at_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_cf);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_screen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":461
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_23mutated_surface(PyObject *__pyx_self, PyObject *__pyx_v_surf); /*proto*/
static char __pyx_doc_5renpy_7display_6render_22mutated_surface[] = "\n    Called to indicate that the given surface has changed.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_23mutated_surface = {"mutated_surface", (PyCFunction)__pyx_pw_5renpy_7display_6render_23mutated_surface, METH_O, __pyx_doc_5renpy_7display_6render_22mutated_surface};
static PyObject *__pyx_pw_5renpy_7display_6render_23mutated_surface(PyObject *__pyx_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mutated_surface (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_22mutated_surface(__pyx_self, ((PyObject *)__pyx_v_surf));

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

static PyObject *__pyx_pf_5renpy_7display_6render_22mutated_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surf) {
  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;
  __Pyx_RefNannySetupContext("mutated_surface", 0);

  /* "renpy/display/render.pyx":466
 *     """
 * 
 *     renpy.display.draw.mutated_surface(surf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __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, 466, __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_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 466, __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_mutated_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 466, __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_v_surf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __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_surf};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __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_surf};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 466, __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_INCREF(__pyx_v_surf);
      __Pyx_GIVEREF(__pyx_v_surf);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_surf);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __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(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":461
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */

  /* 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_AddTraceback("renpy.display.render.mutated_surface", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":469
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_25render_screen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_24render_screen[] = "\n    Renders `root` (a displayable) as the root of a screen with the given\n    `width` and `height`.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_25render_screen = {"render_screen", (PyCFunction)__pyx_pw_5renpy_7display_6render_25render_screen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_24render_screen};
static PyObject *__pyx_pw_5renpy_7display_6render_25render_screen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_root = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_height = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render_screen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_root,&__pyx_n_s_width,&__pyx_n_s_height,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_root)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_screen", 1, 3, 3, 1); __PYX_ERR(0, 469, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_screen", 1, 3, 3, 2); __PYX_ERR(0, 469, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render_screen") < 0)) __PYX_ERR(0, 469, __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_root = values[0];
    __pyx_v_width = values[1];
    __pyx_v_height = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render_screen", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 469, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.render_screen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_24render_screen(__pyx_self, __pyx_v_root, __pyx_v_width, __pyx_v_height);

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

static PyObject *__pyx_pf_5renpy_7display_6render_24render_screen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_root, PyObject *__pyx_v_width, PyObject *__pyx_v_height) {
  PyObject *__pyx_v_interact_time = NULL;
  PyObject *__pyx_v_st = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  double __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  double __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("render_screen", 0);

  /* "renpy/display/render.pyx":479
 *     global frame_time
 * 
 *     interact_time = renpy.display.interface.interact_time             # <<<<<<<<<<<<<<
 *     frame_time = renpy.display.interface.frame_time
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __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, 479, __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_interface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 479, __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_interact_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_interact_time = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":480
 * 
 *     interact_time = renpy.display.interface.interact_time
 *     frame_time = renpy.display.interface.frame_time             # <<<<<<<<<<<<<<
 * 
 *     if interact_time is None:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __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_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 480, __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_frame_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_5renpy_7display_6render_frame_time = __pyx_t_3;

  /* "renpy/display/render.pyx":482
 *     frame_time = renpy.display.interface.frame_time
 * 
 *     if interact_time is None:             # <<<<<<<<<<<<<<
 *         st = 0
 *     else:
 */
  __pyx_t_4 = (__pyx_v_interact_time == Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":483
 * 
 *     if interact_time is None:
 *         st = 0             # <<<<<<<<<<<<<<
 *     else:
 *         st = frame_time  - interact_time
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_st = __pyx_int_0;

    /* "renpy/display/render.pyx":482
 *     frame_time = renpy.display.interface.frame_time
 * 
 *     if interact_time is None:             # <<<<<<<<<<<<<<
 *         st = 0
 *     else:
 */
    goto __pyx_L3;
  }

  /* "renpy/display/render.pyx":485
 *         st = 0
 *     else:
 *         st = frame_time  - interact_time             # <<<<<<<<<<<<<<
 * 
 *     rv = render(root, width, height, st, st)
 */
  /*else*/ {
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_5renpy_7display_6render_frame_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_interact_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_st = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":487
 *         st = frame_time  - interact_time
 * 
 *     rv = render(root, width, height, st, st)             # <<<<<<<<<<<<<<
 *     screen_render = rv
 * 
 */
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_st); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error)
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_st); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 487, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_5renpy_7display_6render_render(__pyx_v_root, __pyx_v_width, __pyx_v_height, __pyx_t_3, __pyx_t_6, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rv = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":488
 * 
 *     rv = render(root, width, height, st, st)
 *     screen_render = rv             # <<<<<<<<<<<<<<
 * 
 *     invalidated = False
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_screen_render, __pyx_v_rv) < 0) __PYX_ERR(0, 488, __pyx_L1_error)

  /* "renpy/display/render.pyx":490
 *     screen_render = rv
 * 
 *     invalidated = False             # <<<<<<<<<<<<<<
 * 
 *     rv.is_opaque()
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_invalidated, Py_False) < 0) __PYX_ERR(0, 490, __pyx_L1_error)

  /* "renpy/display/render.pyx":492
 *     invalidated = False
 * 
 *     rv.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rv, __pyx_n_s_is_opaque); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (__pyx_t_7) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __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/display/render.pyx":494
 *     rv.is_opaque()
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * def mark_sweep():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":469
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.render_screen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_interact_time);
  __Pyx_XDECREF(__pyx_v_st);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":496
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_27mark_sweep(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_26mark_sweep[] = "\n    This performs mark-and-sweep garbage collection on the live_renders\n    list.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_27mark_sweep = {"mark_sweep", (PyCFunction)__pyx_pw_5renpy_7display_6render_27mark_sweep, METH_NOARGS, __pyx_doc_5renpy_7display_6render_26mark_sweep};
static PyObject *__pyx_pw_5renpy_7display_6render_27mark_sweep(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mark_sweep (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_26mark_sweep(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_26mark_sweep(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_worklist = 0;
  int __pyx_v_i;
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_r = 0;
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_j = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("mark_sweep", 0);

  /* "renpy/display/render.pyx":508
 *     cdef Render r, j
 * 
 *     worklist = [ ]             # <<<<<<<<<<<<<<
 * 
 *     if screen_render is not None:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_worklist = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":510
 *     worklist = [ ]
 * 
 *     if screen_render is not None:             # <<<<<<<<<<<<<<
 *         worklist.append(screen_render)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":511
 * 
 *     if screen_render is not None:
 *         worklist.append(screen_render)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_worklist, __pyx_t_1); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 511, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":510
 *     worklist = [ ]
 * 
 *     if screen_render is not None:             # <<<<<<<<<<<<<<
 *         worklist.append(screen_render)
 * 
 */
  }

  /* "renpy/display/render.pyx":513
 *         worklist.append(screen_render)
 * 
 *     i = 0             # <<<<<<<<<<<<<<
 * 
 *     while i < len(worklist):
 */
  __pyx_v_i = 0;

  /* "renpy/display/render.pyx":515
 *     i = 0
 * 
 *     while i < len(worklist):             # <<<<<<<<<<<<<<
 *         r = worklist[i]
 * 
 */
  while (1) {
    __pyx_t_5 = PyList_GET_SIZE(__pyx_v_worklist); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 515, __pyx_L1_error)
    __pyx_t_3 = ((__pyx_v_i < __pyx_t_5) != 0);
    if (!__pyx_t_3) break;

    /* "renpy/display/render.pyx":516
 * 
 *     while i < len(worklist):
 *         r = worklist[i]             # <<<<<<<<<<<<<<
 * 
 *         for j in r.depends_on_list:
 */
    __pyx_t_1 = __Pyx_GetItemInt_List(__pyx_v_worklist, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __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_6render_Render))))) __PYX_ERR(0, 516, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_r, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":518
 *         r = worklist[i]
 * 
 *         for j in r.depends_on_list:             # <<<<<<<<<<<<<<
 *             if not j.mark:
 *                 j.mark = True
 */
    if (unlikely(__pyx_v_r->depends_on_list == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 518, __pyx_L1_error)
    }
    __pyx_t_1 = __pyx_v_r->depends_on_list; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
    for (;;) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 518, __pyx_L1_error)
      #else
      __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 518, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5renpy_7display_6render_Render))))) __PYX_ERR(0, 518, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_j, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "renpy/display/render.pyx":519
 * 
 *         for j in r.depends_on_list:
 *             if not j.mark:             # <<<<<<<<<<<<<<
 *                 j.mark = True
 *                 worklist.append(j)
 */
      __pyx_t_3 = ((!(__pyx_v_j->mark != 0)) != 0);
      if (__pyx_t_3) {

        /* "renpy/display/render.pyx":520
 *         for j in r.depends_on_list:
 *             if not j.mark:
 *                 j.mark = True             # <<<<<<<<<<<<<<
 *                 worklist.append(j)
 * 
 */
        __pyx_v_j->mark = 1;

        /* "renpy/display/render.pyx":521
 *             if not j.mark:
 *                 j.mark = True
 *                 worklist.append(j)             # <<<<<<<<<<<<<<
 * 
 *         i += 1
 */
        __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_worklist, ((PyObject *)__pyx_v_j)); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 521, __pyx_L1_error)

        /* "renpy/display/render.pyx":519
 * 
 *         for j in r.depends_on_list:
 *             if not j.mark:             # <<<<<<<<<<<<<<
 *                 j.mark = True
 *                 worklist.append(j)
 */
      }

      /* "renpy/display/render.pyx":518
 *         r = worklist[i]
 * 
 *         for j in r.depends_on_list:             # <<<<<<<<<<<<<<
 *             if not j.mark:
 *                 j.mark = True
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":523
 *                 worklist.append(j)
 * 
 *         i += 1             # <<<<<<<<<<<<<<
 * 
 *     if screen_render is not None:
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "renpy/display/render.pyx":525
 *         i += 1
 * 
 *     if screen_render is not None:             # <<<<<<<<<<<<<<
 *         screen_render.mark = True
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = (__pyx_t_3 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":526
 * 
 *     if screen_render is not None:
 *         screen_render.mark = True             # <<<<<<<<<<<<<<
 * 
 *     for r in live_renders:
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_1, __pyx_n_s_mark, Py_True) < 0) __PYX_ERR(0, 526, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":525
 *         i += 1
 * 
 *     if screen_render is not None:             # <<<<<<<<<<<<<<
 *         screen_render.mark = True
 * 
 */
  }

  /* "renpy/display/render.pyx":528
 *         screen_render.mark = True
 * 
 *     for r in live_renders:             # <<<<<<<<<<<<<<
 *         if not r.mark:
 *             r.kill_cache()
 */
  if (unlikely(__pyx_v_5renpy_7display_6render_live_renders == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 528, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_5renpy_7display_6render_live_renders; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 528, __pyx_L1_error)
    #else
    __pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5renpy_7display_6render_Render))))) __PYX_ERR(0, 528, __pyx_L1_error)
    __Pyx_XDECREF_SET(__pyx_v_r, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_6));
    __pyx_t_6 = 0;

    /* "renpy/display/render.pyx":529
 * 
 *     for r in live_renders:
 *         if not r.mark:             # <<<<<<<<<<<<<<
 *             r.kill_cache()
 *         else:
 */
    __pyx_t_2 = ((!(__pyx_v_r->mark != 0)) != 0);
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":530
 *     for r in live_renders:
 *         if not r.mark:
 *             r.kill_cache()             # <<<<<<<<<<<<<<
 *         else:
 *             r.mark = False
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_r), __pyx_n_s_kill_cache); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 530, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __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_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 530, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      } else {
        __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 530, __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/display/render.pyx":529
 * 
 *     for r in live_renders:
 *         if not r.mark:             # <<<<<<<<<<<<<<
 *             r.kill_cache()
 *         else:
 */
      goto __pyx_L12;
    }

    /* "renpy/display/render.pyx":532
 *             r.kill_cache()
 *         else:
 *             r.mark = False             # <<<<<<<<<<<<<<
 * 
 *     live_renders = worklist
 */
    /*else*/ {
      __pyx_v_r->mark = 0;
    }
    __pyx_L12:;

    /* "renpy/display/render.pyx":528
 *         screen_render.mark = True
 * 
 *     for r in live_renders:             # <<<<<<<<<<<<<<
 *         if not r.mark:
 *             r.kill_cache()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":534
 *             r.mark = False
 * 
 *     live_renders = worklist             # <<<<<<<<<<<<<<
 * 
 * def compute_subline(sx0, sw, cx0, cw):
 */
  __Pyx_INCREF(__pyx_v_worklist);
  __Pyx_XGOTREF(__pyx_v_5renpy_7display_6render_live_renders);
  __Pyx_DECREF_SET(__pyx_v_5renpy_7display_6render_live_renders, __pyx_v_worklist);
  __Pyx_GIVEREF(__pyx_v_worklist);

  /* "renpy/display/render.pyx":496
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("renpy.display.render.mark_sweep", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_worklist);
  __Pyx_XDECREF((PyObject *)__pyx_v_r);
  __Pyx_XDECREF((PyObject *)__pyx_v_j);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":536
 *     live_renders = worklist
 * 
 * def compute_subline(sx0, sw, cx0, cw):             # <<<<<<<<<<<<<<
 *     """
 *     Given a source line (start sx0, width sw) and a crop line (cx0, cw),
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_29compute_subline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_28compute_subline[] = "\n    Given a source line (start sx0, width sw) and a crop line (cx0, cw),\n    return three things:\n\n    * The offset of the portion of the source line that overlaps with\n      the crop line, relative to the crop line.\n    * The offset of the portion of the source line that overlaps with the\n      the crop line, relative to the source line.\n    * The length of the overlap in pixels. (can be <= 0)\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_29compute_subline = {"compute_subline", (PyCFunction)__pyx_pw_5renpy_7display_6render_29compute_subline, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_28compute_subline};
static PyObject *__pyx_pw_5renpy_7display_6render_29compute_subline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sx0 = 0;
  PyObject *__pyx_v_sw = 0;
  PyObject *__pyx_v_cx0 = 0;
  PyObject *__pyx_v_cw = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("compute_subline (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sx0,&__pyx_n_s_sw,&__pyx_n_s_cx0,&__pyx_n_s_cw,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_sx0)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 1); __PYX_ERR(0, 536, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cx0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 2); __PYX_ERR(0, 536, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 3); __PYX_ERR(0, 536, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute_subline") < 0)) __PYX_ERR(0, 536, __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_sx0 = values[0];
    __pyx_v_sw = values[1];
    __pyx_v_cx0 = values[2];
    __pyx_v_cw = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 536, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.compute_subline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_28compute_subline(__pyx_self, __pyx_v_sx0, __pyx_v_sw, __pyx_v_cx0, __pyx_v_cw);

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

static PyObject *__pyx_pf_5renpy_7display_6render_28compute_subline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sx0, PyObject *__pyx_v_sw, PyObject *__pyx_v_cx0, PyObject *__pyx_v_cw) {
  PyObject *__pyx_v_sx1 = NULL;
  PyObject *__pyx_v_cx1 = NULL;
  PyObject *__pyx_v_start = NULL;
  PyObject *__pyx_v_offset = NULL;
  PyObject *__pyx_v_crop = NULL;
  PyObject *__pyx_v_width = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  __Pyx_RefNannySetupContext("compute_subline", 0);

  /* "renpy/display/render.pyx":548
 *     """
 * 
 *     sx1 = sx0 + sw             # <<<<<<<<<<<<<<
 *     cx1 = cx0 + cw
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_sx0, __pyx_v_sw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sx1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":549
 * 
 *     sx1 = sx0 + sw
 *     cx1 = cx0 + cw             # <<<<<<<<<<<<<<
 * 
 *     if sx0 > cx0:
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_cx0, __pyx_v_cw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cx1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":551
 *     cx1 = cx0 + cw
 * 
 *     if sx0 > cx0:             # <<<<<<<<<<<<<<
 *         start = sx0
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_sx0, __pyx_v_cx0, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 551, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":552
 * 
 *     if sx0 > cx0:
 *         start = sx0             # <<<<<<<<<<<<<<
 *     else:
 *         start = cx0
 */
    __Pyx_INCREF(__pyx_v_sx0);
    __pyx_v_start = __pyx_v_sx0;

    /* "renpy/display/render.pyx":551
 *     cx1 = cx0 + cw
 * 
 *     if sx0 > cx0:             # <<<<<<<<<<<<<<
 *         start = sx0
 *     else:
 */
    goto __pyx_L3;
  }

  /* "renpy/display/render.pyx":554
 *         start = sx0
 *     else:
 *         start = cx0             # <<<<<<<<<<<<<<
 * 
 *     offset = start - cx0
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_cx0);
    __pyx_v_start = __pyx_v_cx0;
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":556
 *         start = cx0
 * 
 *     offset = start - cx0             # <<<<<<<<<<<<<<
 *     crop = start - sx0
 * 
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_start, __pyx_v_cx0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_offset = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":557
 * 
 *     offset = start - cx0
 *     crop = start - sx0             # <<<<<<<<<<<<<<
 * 
 *     if sx1 < cx1:
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_start, __pyx_v_sx0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 557, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_crop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":559
 *     crop = start - sx0
 * 
 *     if sx1 < cx1:             # <<<<<<<<<<<<<<
 *         width = sx1 - start
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_sx1, __pyx_v_cx1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 559, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 559, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":560
 * 
 *     if sx1 < cx1:
 *         width = sx1 - start             # <<<<<<<<<<<<<<
 *     else:
 *         width = cx1 - start
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_sx1, __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 560, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_width = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":559
 *     crop = start - sx0
 * 
 *     if sx1 < cx1:             # <<<<<<<<<<<<<<
 *         width = sx1 - start
 *     else:
 */
    goto __pyx_L4;
  }

  /* "renpy/display/render.pyx":562
 *         width = sx1 - start
 *     else:
 *         width = cx1 - start             # <<<<<<<<<<<<<<
 * 
 *     return offset, crop, width
 */
  /*else*/ {
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_cx1, __pyx_v_start); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_width = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "renpy/display/render.pyx":564
 *         width = cx1 - start
 * 
 *     return offset, crop, width             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_offset);
  __Pyx_GIVEREF(__pyx_v_offset);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_offset);
  __Pyx_INCREF(__pyx_v_crop);
  __Pyx_GIVEREF(__pyx_v_crop);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_crop);
  __Pyx_INCREF(__pyx_v_width);
  __Pyx_GIVEREF(__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_width);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":536
 *     live_renders = worklist
 * 
 * def compute_subline(sx0, sw, cx0, cw):             # <<<<<<<<<<<<<<
 *     """
 *     Given a source line (start sx0, width sw) and a crop line (cx0, cw),
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.compute_subline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sx1);
  __Pyx_XDECREF(__pyx_v_cx1);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_offset);
  __Pyx_XDECREF(__pyx_v_crop);
  __Pyx_XDECREF(__pyx_v_width);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":577
 * cdef class Render:
 * 
 *     def __init__(Render self, float width, float height, draw_func=None, layer_name=None, bint opaque=False): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new render corresponding to the given widget with
 */

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render___init__[] = "\n        Creates a new render corresponding to the given widget with\n        the specified width and height.\n\n        If `layer_name` is given, then this render corresponds to a\n        layer.\n        ";
#if CYTHON_COMPILING_IN_CPYTHON
struct wrapperbase __pyx_wrapperbase_5renpy_7display_6render_6Render___init__;
#endif
static int __pyx_pw_5renpy_7display_6render_6Render_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_width;
  float __pyx_v_height;
  PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_v_layer_name = 0;
  int __pyx_v_opaque;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_draw_func,&__pyx_n_s_layer_name,&__pyx_n_s_opaque,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_None);
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); __PYX_ERR(0, 577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_draw_func);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_layer_name);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_opaque);
          if (value) { values[4] = 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, 577, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_width = __pyx_PyFloat_AsFloat(values[0]); if (unlikely((__pyx_v_width == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 577, __pyx_L3_error)
    __pyx_v_height = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_height == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 577, __pyx_L3_error)
    __pyx_v_draw_func = values[2];
    __pyx_v_layer_name = values[3];
    if (values[4]) {
      __pyx_v_opaque = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_opaque == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 577, __pyx_L3_error)
    } else {
      __pyx_v_opaque = ((int)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 577, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render___init__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_width, __pyx_v_height, __pyx_v_draw_func, __pyx_v_layer_name, __pyx_v_opaque);

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

static int __pyx_pf_5renpy_7display_6render_6Render___init__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, float __pyx_v_width, float __pyx_v_height, PyObject *__pyx_v_draw_func, PyObject *__pyx_v_layer_name, int __pyx_v_opaque) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "renpy/display/render.pyx":588
 *         # The mark bit, used for mark/sweep-style garbage collection of
 *         # renders.
 *         self.mark = False             # <<<<<<<<<<<<<<
 * 
 *         # Is has this render been removed from the cache?
 */
  __pyx_v_self->mark = 0;

  /* "renpy/display/render.pyx":591
 * 
 *         # Is has this render been removed from the cache?
 *         self.cache_killed = False             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_v_self->cache_killed = 0;

  /* "renpy/display/render.pyx":594
 * 
 * 
 *         self.width = width             # <<<<<<<<<<<<<<
 *         self.height = height
 * 
 */
  __pyx_v_self->width = __pyx_v_width;

  /* "renpy/display/render.pyx":595
 * 
 *         self.width = width
 *         self.height = height             # <<<<<<<<<<<<<<
 * 
 *         self.layer_name = layer_name
 */
  __pyx_v_self->height = __pyx_v_height;

  /* "renpy/display/render.pyx":597
 *         self.height = height
 * 
 *         self.layer_name = layer_name             # <<<<<<<<<<<<<<
 * 
 *         # A list of (surface/render, xoffset, yoffset, focus, main) tuples, ordered from
 */
  __Pyx_INCREF(__pyx_v_layer_name);
  __Pyx_GIVEREF(__pyx_v_layer_name);
  __Pyx_GOTREF(__pyx_v_self->layer_name);
  __Pyx_DECREF(__pyx_v_self->layer_name);
  __pyx_v_self->layer_name = __pyx_v_layer_name;

  /* "renpy/display/render.pyx":601
 *         # A list of (surface/render, xoffset, yoffset, focus, main) tuples, ordered from
 *         # back to front.
 *         self.children = [ ]             # <<<<<<<<<<<<<<
 * 
 *         # The set of renders that either have us as children, or depend on
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 601, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->children);
  __Pyx_DECREF(__pyx_v_self->children);
  __pyx_v_self->children = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":605
 *         # The set of renders that either have us as children, or depend on
 *         # us.
 *         self.parents = set()             # <<<<<<<<<<<<<<
 * 
 *         # The renders we depend on, including our children.
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->parents);
  __Pyx_DECREF(__pyx_v_self->parents);
  __pyx_v_self->parents = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":608
 * 
 *         # The renders we depend on, including our children.
 *         self.depends_on_list = [ ]             # <<<<<<<<<<<<<<
 * 
 *         # The operation we're performing. (BLIT, DISSOLVE, OR IMAGE_DISSOLVE)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->depends_on_list);
  __Pyx_DECREF(__pyx_v_self->depends_on_list);
  __pyx_v_self->depends_on_list = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":611
 * 
 *         # The operation we're performing. (BLIT, DISSOLVE, OR IMAGE_DISSOLVE)
 *         self.operation = BLIT             # <<<<<<<<<<<<<<
 * 
 *         # The fraction of the operation that is complete.
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_BLIT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 611, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->operation = __pyx_t_2;

  /* "renpy/display/render.pyx":614
 * 
 *         # The fraction of the operation that is complete.
 *         self.operation_complete = 0.0             # <<<<<<<<<<<<<<
 * 
 *         # Should the dissolve operations preserve alpha?
 */
  __pyx_v_self->operation_complete = 0.0;

  /* "renpy/display/render.pyx":617
 * 
 *         # Should the dissolve operations preserve alpha?
 *         self.operation_alpha = False             # <<<<<<<<<<<<<<
 * 
 *         # The parameter to the operation.
 */
  __pyx_v_self->operation_alpha = 0;

  /* "renpy/display/render.pyx":620
 * 
 *         # The parameter to the operation.
 *         self.operation_parameter = 0             # <<<<<<<<<<<<<<
 * 
 *         # Forward is used to transform from screen coordinates to child
 */
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GOTREF(__pyx_v_self->operation_parameter);
  __Pyx_DECREF(__pyx_v_self->operation_parameter);
  __pyx_v_self->operation_parameter = __pyx_int_0;

  /* "renpy/display/render.pyx":630
 *         # x and y offsets found in self.children. Those offsets should
 *         # be of the (0, 0) point in the child coordinate space.
 *         self.forward = None             # <<<<<<<<<<<<<<
 *         self.reverse = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->forward);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->forward));
  __pyx_v_self->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

  /* "renpy/display/render.pyx":631
 *         # be of the (0, 0) point in the child coordinate space.
 *         self.forward = None
 *         self.reverse = None             # <<<<<<<<<<<<<<
 * 
 *         # This is used to adjust the alpha of children of this render.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->reverse);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reverse));
  __pyx_v_self->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

  /* "renpy/display/render.pyx":634
 * 
 *         # This is used to adjust the alpha of children of this render.
 *         self.alpha = 1             # <<<<<<<<<<<<<<
 * 
 *         # The over blending factor. When this is 1.0, blends only use the
 */
  __pyx_v_self->alpha = 1.0;

  /* "renpy/display/render.pyx":638
 *         # The over blending factor. When this is 1.0, blends only use the
 *         # over operation. When set to 0.0, we get additive blending.
 *         self.over = 1.0             # <<<<<<<<<<<<<<
 * 
 *         # If true, children of this render use nearest-neighbor texture
 */
  __pyx_v_self->over = 1.0;

  /* "renpy/display/render.pyx":642
 *         # If true, children of this render use nearest-neighbor texture
 *         # lookup. If false, bilinear, if None, from the parent.
 *         self.nearest = None             # <<<<<<<<<<<<<<
 * 
 *         # A list of focus regions in this displayable.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->nearest);
  __Pyx_DECREF(__pyx_v_self->nearest);
  __pyx_v_self->nearest = Py_None;

  /* "renpy/display/render.pyx":645
 * 
 *         # A list of focus regions in this displayable.
 *         self.focuses = None             # <<<<<<<<<<<<<<
 * 
 *         # Other renders that we should pass focus onto.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->focuses);
  __Pyx_DECREF(__pyx_v_self->focuses);
  __pyx_v_self->focuses = ((PyObject*)Py_None);

  /* "renpy/display/render.pyx":648
 * 
 *         # Other renders that we should pass focus onto.
 *         self.pass_focuses = None             # <<<<<<<<<<<<<<
 * 
 *         # The ScreenDisplayable this is a render of.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->pass_focuses);
  __Pyx_DECREF(__pyx_v_self->pass_focuses);
  __pyx_v_self->pass_focuses = ((PyObject*)Py_None);

  /* "renpy/display/render.pyx":651
 * 
 *         # The ScreenDisplayable this is a render of.
 *         self.focus_screen = None             # <<<<<<<<<<<<<<
 * 
 *         # The displayable(s) that this is a render of. (Set by render)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->focus_screen);
  __Pyx_DECREF(__pyx_v_self->focus_screen);
  __pyx_v_self->focus_screen = Py_None;

  /* "renpy/display/render.pyx":654
 * 
 *         # The displayable(s) that this is a render of. (Set by render)
 *         self.render_of = [ ]             # <<<<<<<<<<<<<<
 * 
 *         # If set, this is a function that's called to draw this render
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 654, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->render_of);
  __Pyx_DECREF(__pyx_v_self->render_of);
  __pyx_v_self->render_of = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":658
 *         # If set, this is a function that's called to draw this render
 *         # instead of the default.
 *         self.draw_func = draw_func             # <<<<<<<<<<<<<<
 * 
 *         # Is this displayable opaque? (May be set on init, or later on
 */
  __Pyx_INCREF(__pyx_v_draw_func);
  __Pyx_GIVEREF(__pyx_v_draw_func);
  __Pyx_GOTREF(__pyx_v_self->draw_func);
  __Pyx_DECREF(__pyx_v_self->draw_func);
  __pyx_v_self->draw_func = __pyx_v_draw_func;

  /* "renpy/display/render.pyx":663
 *         # if we have opaque children.) This may be True, False, or None
 *         # to indicate we don't know yet.
 *         self.opaque = opaque             # <<<<<<<<<<<<<<
 * 
 *         # A list of our visible children. (That is, children above and
 */
  __pyx_v_self->opaque = __pyx_v_opaque;

  /* "renpy/display/render.pyx":668
 *         # including our uppermost opaque child.) If nothing is opaque,
 *         # includes all children.
 *         self.visible_children = self.children             # <<<<<<<<<<<<<<
 * 
 *         # Should children be clipped to a rectangle?
 */
  __pyx_t_1 = __pyx_v_self->children;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->visible_children);
  __Pyx_DECREF(__pyx_v_self->visible_children);
  __pyx_v_self->visible_children = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":671
 * 
 *         # Should children be clipped to a rectangle?
 *         self.xclipping = False             # <<<<<<<<<<<<<<
 *         self.yclipping = False
 * 
 */
  __pyx_v_self->xclipping = 0;

  /* "renpy/display/render.pyx":672
 *         # Should children be clipped to a rectangle?
 *         self.xclipping = False
 *         self.yclipping = False             # <<<<<<<<<<<<<<
 * 
 *         # Caches of the texture created by rendering this surface.
 */
  __pyx_v_self->yclipping = 0;

  /* "renpy/display/render.pyx":675
 * 
 *         # Caches of the texture created by rendering this surface.
 *         self.surface = None             # <<<<<<<<<<<<<<
 *         self.alpha_surface = None
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->surface);
  __Pyx_DECREF(__pyx_v_self->surface);
  __pyx_v_self->surface = Py_None;

  /* "renpy/display/render.pyx":676
 *         # Caches of the texture created by rendering this surface.
 *         self.surface = None
 *         self.alpha_surface = None             # <<<<<<<<<<<<<<
 * 
 *         # Cache of the texture created by rendering this surface at half size.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->alpha_surface);
  __Pyx_DECREF(__pyx_v_self->alpha_surface);
  __pyx_v_self->alpha_surface = Py_None;

  /* "renpy/display/render.pyx":680
 *         # Cache of the texture created by rendering this surface at half size.
 *         # (This is set in gldraw.)
 *         self.half_cache = None             # <<<<<<<<<<<<<<
 * 
 *         # Are we modal?
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->half_cache);
  __Pyx_DECREF(__pyx_v_self->half_cache);
  __pyx_v_self->half_cache = Py_None;

  /* "renpy/display/render.pyx":683
 * 
 *         # Are we modal?
 *         self.modal = False             # <<<<<<<<<<<<<<
 * 
 *         # Are we a text input?
 */
  __pyx_v_self->modal = 0;

  /* "renpy/display/render.pyx":686
 * 
 *         # Are we a text input?
 *         self.text_input = False             # <<<<<<<<<<<<<<
 * 
 *         live_renders.append(self)
 */
  __pyx_v_self->text_input = 0;

  /* "renpy/display/render.pyx":688
 *         self.text_input = False
 * 
 *         live_renders.append(self)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self): #@DuplicatedSignature
 */
  if (unlikely(__pyx_v_5renpy_7display_6render_live_renders == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 688, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyList_Append(__pyx_v_5renpy_7display_6render_live_renders, ((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 688, __pyx_L1_error)

  /* "renpy/display/render.pyx":577
 * cdef class Render:
 * 
 *     def __init__(Render self, float width, float height, draw_func=None, layer_name=None, bint opaque=False): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new render corresponding to the given widget with
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":690
 *         live_renders.append(self)
 * 
 *     def __repr__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return "<Render %x of %r>" % (id(self), self.render_of)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_3__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_3__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_2__repr__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_2__repr__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "renpy/display/render.pyx":691
 * 
 *     def __repr__(self): #@DuplicatedSignature
 *         return "<Render %x of %r>" % (id(self), self.render_of)             # <<<<<<<<<<<<<<
 * 
 *     def __getstate__(self): #@DuplicatedSignature
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self->render_of);
  __Pyx_GIVEREF(__pyx_v_self->render_of);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->render_of);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Render_x_of_r, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 691, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":690
 *         live_renders.append(self)
 * 
 *     def __repr__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return "<Render %x of %r>" % (id(self), self.render_of)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("renpy.display.render.Render.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":693
 *         return "<Render %x of %r>" % (id(self), self.render_of)
 * 
 *     def __getstate__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_4__getstate__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4__getstate__(CYTHON_UNUSED struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__getstate__", 0);

  /* "renpy/display/render.pyx":694
 * 
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:             # <<<<<<<<<<<<<<
 *             raise Exception("Can't pickle a Render.")
 *         else:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __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, 694, __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_developer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __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, 694, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":695
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")             # <<<<<<<<<<<<<<
 *         else:
 *             return { }
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __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, 695, __pyx_L1_error)

    /* "renpy/display/render.pyx":694
 * 
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:             # <<<<<<<<<<<<<<
 *             raise Exception("Can't pickle a Render.")
 *         else:
 */
  }

  /* "renpy/display/render.pyx":697
 *             raise Exception("Can't pickle a Render.")
 *         else:
 *             return { }             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, state): #@DuplicatedSignature
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 697, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "renpy/display/render.pyx":693
 *         return "<Render %x of %r>" % (id(self), self.render_of)
 * 
 *     def __getstate__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("renpy.display.render.Render.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":699
 *             return { }
 * 
 *     def __setstate__(self, state): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_6__setstate__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_state));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6__setstate__(CYTHON_UNUSED struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__", 0);

  /* "renpy/display/render.pyx":700
 * 
 *     def __setstate__(self, state): #@DuplicatedSignature
 *         return             # <<<<<<<<<<<<<<
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

  /* "renpy/display/render.pyx":699
 *             return { }
 * 
 *     def __setstate__(self, state): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return
 * 
 */

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

/* "renpy/display/render.pyx":702
 *         return
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */

static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_7display_6render_6Render_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_blit *__pyx_optional_args) {
  PyObject *__pyx_v_focus = ((PyObject *)Py_True);
  PyObject *__pyx_v_main = ((PyObject *)Py_True);
  PyObject *__pyx_v_index = ((PyObject *)Py_None);
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = 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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("blit", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_focus = __pyx_optional_args->focus;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_main = __pyx_optional_args->main;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_index = __pyx_optional_args->index;
        }
      }
    }
  }
  /* 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_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 702, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_9blit)) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      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);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __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[6] = {__pyx_t_4, __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 702, __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_v_source);
        __Pyx_GIVEREF(__pyx_v_source);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_source);
        __Pyx_INCREF(__pyx_v_pos);
        __Pyx_GIVEREF(__pyx_v_pos);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_pos);
        __Pyx_INCREF(__pyx_v_focus);
        __Pyx_GIVEREF(__pyx_v_focus);
        PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_focus);
        __Pyx_INCREF(__pyx_v_main);
        __Pyx_GIVEREF(__pyx_v_main);
        PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_v_main);
        __Pyx_INCREF(__pyx_v_index);
        __Pyx_GIVEREF(__pyx_v_index);
        PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_5, __pyx_v_index);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 702, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 702, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":713
 *         """
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         if source is self:
 */
  if (likely(__pyx_v_pos != Py_None)) {
    PyObject* sequence = __pyx_v_pos;
    #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, 713, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 713, __pyx_L1_error)
  }
  __pyx_v_xo = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_yo = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":715
 *         (xo, yo) = pos
 * 
 *         if source is self:             # <<<<<<<<<<<<<<
 *             raise Exception("Blitting to self.")
 * 
 */
  __pyx_t_7 = (__pyx_v_source == ((PyObject *)__pyx_v_self));
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":716
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         xo = int(xo)
 */
    __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 716, __pyx_L1_error)

    /* "renpy/display/render.pyx":715
 *         (xo, yo) = pos
 * 
 *         if source is self:             # <<<<<<<<<<<<<<
 *             raise Exception("Blitting to self.")
 * 
 */
  }

  /* "renpy/display/render.pyx":718
 *             raise Exception("Blitting to self.")
 * 
 *         xo = int(xo)             # <<<<<<<<<<<<<<
 *         yo = int(yo)
 * 
 */
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_xo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":719
 * 
 *         xo = int(xo)
 *         yo = int(yo)             # <<<<<<<<<<<<<<
 * 
 *         if index is None:
 */
  __pyx_t_2 = __Pyx_PyNumber_Int(__pyx_v_yo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":721
 *         yo = int(yo)
 * 
 *         if index is None:             # <<<<<<<<<<<<<<
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 */
  __pyx_t_8 = (__pyx_v_index == Py_None);
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":722
 * 
 *         if index is None:
 *             self.children.append((source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))
 */
    if (unlikely(__pyx_v_self->children == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 722, __pyx_L1_error)
    }
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 722, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_main);
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->children, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 722, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":721
 *         yo = int(yo)
 * 
 *         if index is None:             # <<<<<<<<<<<<<<
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 */
    goto __pyx_L4;
  }

  /* "renpy/display/render.pyx":724
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(source, Render):
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->children == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "insert");
      __PYX_ERR(0, 724, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 724, __pyx_L1_error)
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_main);
    __pyx_t_9 = PyList_Insert(__pyx_v_self->children, __pyx_t_10, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L4:;

  /* "renpy/display/render.pyx":726
 *             self.children.insert(index, (source, xo, yo, focus, main))
 * 
 *         if isinstance(source, Render):             # <<<<<<<<<<<<<<
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)
 */
  __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_source, __pyx_ptype_5renpy_7display_6render_Render); 
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":727
 * 
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)             # <<<<<<<<<<<<<<
 *             source.parents.add(self)
 * 
 */
    if (unlikely(__pyx_v_self->depends_on_list == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 727, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->depends_on_list, __pyx_v_source); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 727, __pyx_L1_error)

    /* "renpy/display/render.pyx":728
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_parents); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 728, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    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);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __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_1, ((PyObject *)__pyx_v_self)};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __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[2] = {__pyx_t_1, ((PyObject *)__pyx_v_self)};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 728, __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_INCREF(((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_v_self));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 728, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":726
 *             self.children.insert(index, (source, xo, yo, focus, main))
 * 
 *         if isinstance(source, Render):             # <<<<<<<<<<<<<<
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)
 */
  }

  /* "renpy/display/render.pyx":730
 *             source.parents.add(self)
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":702
 *         return
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */

  /* 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_6);
  __Pyx_WriteUnraisable("renpy.display.render.Render.blit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_8blit[] = "\n        Blits `source` (a Render or Surface) to this Render, offset by\n        xo and yo.\n\n        If `focus` is true, then focuses are added from the child to the\n        parent.\n\n        This will only blit on integer pixel boundaries.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_v_main = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_pos,&__pyx_n_s_focus,&__pyx_n_s_main,&__pyx_n_s_index,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("blit", 0, 2, 5, 1); __PYX_ERR(0, 702, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_focus);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_main);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blit") < 0)) __PYX_ERR(0, 702, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = values[0];
    __pyx_v_pos = ((PyObject*)values[1]);
    __pyx_v_focus = values[2];
    __pyx_v_main = values[3];
    __pyx_v_index = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("blit", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 702, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(0, 702, __pyx_L1_error)
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_8blit(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, PyObject *__pyx_v_focus, PyObject *__pyx_v_main, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  struct __pyx_opt_args_5renpy_7display_6render_6Render_blit __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("blit", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.focus = __pyx_v_focus;
  __pyx_t_2.main = __pyx_v_main;
  __pyx_t_2.index = __pyx_v_index;
  __pyx_t_1 = __pyx_vtabptr_5renpy_7display_6render_Render->blit(__pyx_v_self, __pyx_v_source, __pyx_v_pos, 1, &__pyx_t_2); 
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 702, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.display.render.Render.blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":732
 *         return 0
 * 
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */

static PyObject *__pyx_pw_5renpy_7display_6render_6Render_11subpixel_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_7display_6render_6Render_subpixel_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit *__pyx_optional_args) {
  PyObject *__pyx_v_focus = ((PyObject *)Py_True);
  PyObject *__pyx_v_main = ((PyObject *)Py_True);
  PyObject *__pyx_v_index = ((PyObject *)Py_None);
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = 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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("subpixel_blit", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_focus = __pyx_optional_args->focus;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_main = __pyx_optional_args->main;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_index = __pyx_optional_args->index;
        }
      }
    }
  }
  /* 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_subpixel_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_11subpixel_blit)) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      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);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __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[6] = {__pyx_t_4, __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 732, __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_v_source);
        __Pyx_GIVEREF(__pyx_v_source);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_source);
        __Pyx_INCREF(__pyx_v_pos);
        __Pyx_GIVEREF(__pyx_v_pos);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_pos);
        __Pyx_INCREF(__pyx_v_focus);
        __Pyx_GIVEREF(__pyx_v_focus);
        PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_focus);
        __Pyx_INCREF(__pyx_v_main);
        __Pyx_GIVEREF(__pyx_v_main);
        PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_v_main);
        __Pyx_INCREF(__pyx_v_index);
        __Pyx_GIVEREF(__pyx_v_index);
        PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_5, __pyx_v_index);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 732, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 732, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":743
 *         """
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         xo = float(xo)
 */
  if (likely(__pyx_v_pos != Py_None)) {
    PyObject* sequence = __pyx_v_pos;
    #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, 743, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 743, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 743, __pyx_L1_error)
  }
  __pyx_v_xo = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_yo = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":745
 *         (xo, yo) = pos
 * 
 *         xo = float(xo)             # <<<<<<<<<<<<<<
 *         yo = float(yo)
 * 
 */
  __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_v_xo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 745, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":746
 * 
 *         xo = float(xo)
 *         yo = float(yo)             # <<<<<<<<<<<<<<
 * 
 *         if index is None:
 */
  __pyx_t_2 = __Pyx_PyNumber_Float(__pyx_v_yo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 746, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":748
 *         yo = float(yo)
 * 
 *         if index is None:             # <<<<<<<<<<<<<<
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 */
  __pyx_t_7 = (__pyx_v_index == Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":749
 * 
 *         if index is None:
 *             self.children.append((source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))
 */
    if (unlikely(__pyx_v_self->children == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 749, __pyx_L1_error)
    }
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_main);
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->children, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 749, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":748
 *         yo = float(yo)
 * 
 *         if index is None:             # <<<<<<<<<<<<<<
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "renpy/display/render.pyx":751
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(source, Render):
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->children == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "insert");
      __PYX_ERR(0, 751, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 751, __pyx_L1_error)
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 751, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_main);
    __pyx_t_9 = PyList_Insert(__pyx_v_self->children, __pyx_t_10, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 751, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":753
 *             self.children.insert(index, (source, xo, yo, focus, main))
 * 
 *         if isinstance(source, Render):             # <<<<<<<<<<<<<<
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)
 */
  __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_source, __pyx_ptype_5renpy_7display_6render_Render); 
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":754
 * 
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)             # <<<<<<<<<<<<<<
 *             source.parents.add(self)
 * 
 */
    if (unlikely(__pyx_v_self->depends_on_list == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 754, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->depends_on_list, __pyx_v_source); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 754, __pyx_L1_error)

    /* "renpy/display/render.pyx":755
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_parents); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 755, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = NULL;
    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);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __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_1, ((PyObject *)__pyx_v_self)};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __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[2] = {__pyx_t_1, ((PyObject *)__pyx_v_self)};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 755, __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_INCREF(((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_v_self));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 755, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":753
 *             self.children.insert(index, (source, xo, yo, focus, main))
 * 
 *         if isinstance(source, Render):             # <<<<<<<<<<<<<<
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)
 */
  }

  /* "renpy/display/render.pyx":757
 *             source.parents.add(self)
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     cpdef int absolute_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":732
 *         return 0
 * 
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */

  /* 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_6);
  __Pyx_WriteUnraisable("renpy.display.render.Render.subpixel_blit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_11subpixel_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_10subpixel_blit[] = "\n        Blits `source` (a Render or Surface) to this Render, offset by\n        xo and yo.\n\n        If `focus` is true, then focuses are added from the child to the\n        parent.\n\n        This blits at fractional pixel boundaries.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_11subpixel_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_v_main = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subpixel_blit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_pos,&__pyx_n_s_focus,&__pyx_n_s_main,&__pyx_n_s_index,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("subpixel_blit", 0, 2, 5, 1); __PYX_ERR(0, 732, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_focus);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_main);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subpixel_blit") < 0)) __PYX_ERR(0, 732, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = values[0];
    __pyx_v_pos = ((PyObject*)values[1]);
    __pyx_v_focus = values[2];
    __pyx_v_main = values[3];
    __pyx_v_index = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subpixel_blit", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 732, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.subpixel_blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(0, 732, __pyx_L1_error)
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_10subpixel_blit(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10subpixel_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, PyObject *__pyx_v_focus, PyObject *__pyx_v_main, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("subpixel_blit", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.focus = __pyx_v_focus;
  __pyx_t_2.main = __pyx_v_main;
  __pyx_t_2.index = __pyx_v_index;
  __pyx_t_1 = __pyx_vtabptr_5renpy_7display_6render_Render->subpixel_blit(__pyx_v_self, __pyx_v_source, __pyx_v_pos, 1, &__pyx_t_2); 
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 732, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.display.render.Render.subpixel_blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":759
 *         return 0
 * 
 *     cpdef int absolute_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */

static PyObject *__pyx_pw_5renpy_7display_6render_6Render_13absolute_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_7display_6render_6Render_absolute_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_absolute_blit *__pyx_optional_args) {
  PyObject *__pyx_v_focus = ((PyObject *)Py_True);
  PyObject *__pyx_v_main = ((PyObject *)Py_True);
  PyObject *__pyx_v_index = ((PyObject *)Py_None);
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = 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;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  __Pyx_RefNannySetupContext("absolute_blit", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_focus = __pyx_optional_args->focus;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_main = __pyx_optional_args->main;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_index = __pyx_optional_args->index;
        }
      }
    }
  }
  /* 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_absolute_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 759, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_13absolute_blit)) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL;
      __pyx_t_5 = 0;
      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);
          __pyx_t_5 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_3)) {
        PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __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[6] = {__pyx_t_4, __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 5+__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_6 = PyTuple_New(5+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 759, __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_v_source);
        __Pyx_GIVEREF(__pyx_v_source);
        PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_source);
        __Pyx_INCREF(__pyx_v_pos);
        __Pyx_GIVEREF(__pyx_v_pos);
        PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_pos);
        __Pyx_INCREF(__pyx_v_focus);
        __Pyx_GIVEREF(__pyx_v_focus);
        PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_focus);
        __Pyx_INCREF(__pyx_v_main);
        __Pyx_GIVEREF(__pyx_v_main);
        PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_5, __pyx_v_main);
        __Pyx_INCREF(__pyx_v_index);
        __Pyx_GIVEREF(__pyx_v_index);
        PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_5, __pyx_v_index);
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 759, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_5;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":770
 *         """
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         xo = renpy.display.core.absolute(xo)
 */
  if (likely(__pyx_v_pos != Py_None)) {
    PyObject* sequence = __pyx_v_pos;
    #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, 770, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 770, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 770, __pyx_L1_error)
  }
  __pyx_v_xo = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_yo = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":772
 *         (xo, yo) = pos
 * 
 *         xo = renpy.display.core.absolute(xo)             # <<<<<<<<<<<<<<
 *         yo = renpy.display.core.absolute(yo)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __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, 772, __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_core); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __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_absolute); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  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);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_xo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __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_1, __pyx_v_xo};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __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[2] = {__pyx_t_1, __pyx_v_xo};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 772, __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_INCREF(__pyx_v_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_xo);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":773
 * 
 *         xo = renpy.display.core.absolute(xo)
 *         yo = renpy.display.core.absolute(yo)             # <<<<<<<<<<<<<<
 * 
 *         if index is None:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_display); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 773, __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_core); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __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_absolute); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_yo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_yo};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __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_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_yo};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 773, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_yo);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":775
 *         yo = renpy.display.core.absolute(yo)
 * 
 *         if index is None:             # <<<<<<<<<<<<<<
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 */
  __pyx_t_7 = (__pyx_v_index == Py_None);
  __pyx_t_8 = (__pyx_t_7 != 0);
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":776
 * 
 *         if index is None:
 *             self.children.append((source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))
 */
    if (unlikely(__pyx_v_self->children == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 776, __pyx_L1_error)
    }
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_main);
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->children, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 776, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":775
 *         yo = renpy.display.core.absolute(yo)
 * 
 *         if index is None:             # <<<<<<<<<<<<<<
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 */
    goto __pyx_L3;
  }

  /* "renpy/display/render.pyx":778
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(source, Render):
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->children == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "insert");
      __PYX_ERR(0, 778, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L1_error)
    __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_main);
    __pyx_t_9 = PyList_Insert(__pyx_v_self->children, __pyx_t_10, __pyx_t_2); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 778, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":780
 *             self.children.insert(index, (source, xo, yo, focus, main))
 * 
 *         if isinstance(source, Render):             # <<<<<<<<<<<<<<
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)
 */
  __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_source, __pyx_ptype_5renpy_7display_6render_Render); 
  __pyx_t_7 = (__pyx_t_8 != 0);
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":781
 * 
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)             # <<<<<<<<<<<<<<
 *             source.parents.add(self)
 * 
 */
    if (unlikely(__pyx_v_self->depends_on_list == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 781, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->depends_on_list, __pyx_v_source); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 781, __pyx_L1_error)

    /* "renpy/display/render.pyx":782
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_parents); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 782, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_v_self)};
        __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_v_self)};
        __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_2);
      } else
      #endif
      {
        __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __pyx_t_6 = NULL;
        __Pyx_INCREF(((PyObject *)__pyx_v_self));
        __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
        PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_self));
        __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":780
 *             self.children.insert(index, (source, xo, yo, focus, main))
 * 
 *         if isinstance(source, Render):             # <<<<<<<<<<<<<<
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)
 */
  }

  /* "renpy/display/render.pyx":784
 *             source.parents.add(self)
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":759
 *         return 0
 * 
 *     cpdef int absolute_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */

  /* 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_6);
  __Pyx_WriteUnraisable("renpy.display.render.Render.absolute_blit", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_13absolute_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_12absolute_blit[] = "\n        Blits `source` (a Render or Surface) to this Render, offset by\n        xo and yo.\n\n        If `focus` is true, then focuses are added from the child to the\n        parent.\n\n        This blits at fractional pixel boundaries.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_13absolute_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_v_main = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("absolute_blit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_pos,&__pyx_n_s_focus,&__pyx_n_s_main,&__pyx_n_s_index,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = ((PyObject *)Py_True);
    values[3] = ((PyObject *)Py_True);
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("absolute_blit", 0, 2, 5, 1); __PYX_ERR(0, 759, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_focus);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_main);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_index);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "absolute_blit") < 0)) __PYX_ERR(0, 759, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_source = values[0];
    __pyx_v_pos = ((PyObject*)values[1]);
    __pyx_v_focus = values[2];
    __pyx_v_main = values[3];
    __pyx_v_index = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("absolute_blit", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 759, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.absolute_blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_pos), (&PyTuple_Type), 1, "pos", 1))) __PYX_ERR(0, 759, __pyx_L1_error)
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_12absolute_blit(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_source, __pyx_v_pos, __pyx_v_focus, __pyx_v_main, __pyx_v_index);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12absolute_blit(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_pos, PyObject *__pyx_v_focus, PyObject *__pyx_v_main, PyObject *__pyx_v_index) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  struct __pyx_opt_args_5renpy_7display_6render_6Render_absolute_blit __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("absolute_blit", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2.__pyx_n = 3;
  __pyx_t_2.focus = __pyx_v_focus;
  __pyx_t_2.main = __pyx_v_main;
  __pyx_t_2.index = __pyx_v_index;
  __pyx_t_1 = __pyx_vtabptr_5renpy_7display_6render_Render->absolute_blit(__pyx_v_self, __pyx_v_source, __pyx_v_pos, 1, &__pyx_t_2); 
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 759, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.display.render.Render.absolute_blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":787
 * 
 * 
 *     def get_size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of this Render, a mostly ficticious value
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_15get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_14get_size[] = "\n        Returns the size of this Render, a mostly ficticious value\n        that's taken from the inputs to the constructor. (As in, we\n        don't clip to this size.)\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_15get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_size (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_14get_size(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_14get_size(struct __pyx_obj_5renpy_7display_6render_Render *__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_size", 0);

  /* "renpy/display/render.pyx":794
 *         """
 * 
 *         return self.width, self.height             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":787
 * 
 * 
 *     def get_size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of this Render, a mostly ficticious value
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.display.render.Render.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":797
 * 
 * 
 *     def render_to_texture(self, alpha=True):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a texture constructed from this render. This may return
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_17render_to_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_16render_to_texture[] = "\n        Returns a texture constructed from this render. This may return\n        a cached texture, if one has already been rendered.\n\n        `alpha` is a hint that controls if the surface should have\n        alpha or not.\n\n        This returns a texture that's at the drawable resolution, which\n        may be bigger than the virtual resolution. Use renpy.display.draw.draw_to_virt\n        and draw.virt_to_draw to convert between the two resolutions. (For example,\n        multiply reverse by draw_to_virt to scale this down for blitting.)\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_17render_to_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  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_alpha,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_alpha);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render_to_texture") < 0)) __PYX_ERR(0, 797, __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_alpha = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render_to_texture", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 797, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.render_to_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_16render_to_texture(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_alpha);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16render_to_texture(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_alpha) {
  PyObject *__pyx_v_rv = 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;
  __Pyx_RefNannySetupContext("render_to_texture", 0);

  /* "renpy/display/render.pyx":811
 *         """
 * 
 *         if alpha:             # <<<<<<<<<<<<<<
 *             if self.alpha_surface is not None:
 *                 return self.alpha_surface
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_alpha); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 811, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":812
 * 
 *         if alpha:
 *             if self.alpha_surface is not None:             # <<<<<<<<<<<<<<
 *                 return self.alpha_surface
 *         else:
 */
    __pyx_t_1 = (__pyx_v_self->alpha_surface != Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":813
 *         if alpha:
 *             if self.alpha_surface is not None:
 *                 return self.alpha_surface             # <<<<<<<<<<<<<<
 *         else:
 *             if self.surface is not None:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_self->alpha_surface);
      __pyx_r = __pyx_v_self->alpha_surface;
      goto __pyx_L0;

      /* "renpy/display/render.pyx":812
 * 
 *         if alpha:
 *             if self.alpha_surface is not None:             # <<<<<<<<<<<<<<
 *                 return self.alpha_surface
 *         else:
 */
    }

    /* "renpy/display/render.pyx":811
 *         """
 * 
 *         if alpha:             # <<<<<<<<<<<<<<
 *             if self.alpha_surface is not None:
 *                 return self.alpha_surface
 */
    goto __pyx_L3;
  }

  /* "renpy/display/render.pyx":815
 *                 return self.alpha_surface
 *         else:
 *             if self.surface is not None:             # <<<<<<<<<<<<<<
 *                 return self.surface
 * 
 */
  /*else*/ {
    __pyx_t_2 = (__pyx_v_self->surface != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":816
 *         else:
 *             if self.surface is not None:
 *                 return self.surface             # <<<<<<<<<<<<<<
 * 
 *         rv = renpy.display.draw.render_to_texture(self, alpha)
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_self->surface);
      __pyx_r = __pyx_v_self->surface;
      goto __pyx_L0;

      /* "renpy/display/render.pyx":815
 *                 return self.alpha_surface
 *         else:
 *             if self.surface is not None:             # <<<<<<<<<<<<<<
 *                 return self.surface
 * 
 */
    }
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":818
 *                 return self.surface
 * 
 *         rv = renpy.display.draw.render_to_texture(self, alpha)             # <<<<<<<<<<<<<<
 * 
 *         # Stash and return the surface.
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __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, 818, __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_draw); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __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_render_to_texture); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_alpha};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[3] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_alpha};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 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, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
    __Pyx_INCREF(__pyx_v_alpha);
    __Pyx_GIVEREF(__pyx_v_alpha);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_alpha);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 818, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_rv = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":821
 * 
 *         # Stash and return the surface.
 *         if alpha:             # <<<<<<<<<<<<<<
 *             self.alpha_surface = rv
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_alpha); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 821, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":822
 *         # Stash and return the surface.
 *         if alpha:
 *             self.alpha_surface = rv             # <<<<<<<<<<<<<<
 *         else:
 *             self.surface = rv
 */
    __Pyx_INCREF(__pyx_v_rv);
    __Pyx_GIVEREF(__pyx_v_rv);
    __Pyx_GOTREF(__pyx_v_self->alpha_surface);
    __Pyx_DECREF(__pyx_v_self->alpha_surface);
    __pyx_v_self->alpha_surface = __pyx_v_rv;

    /* "renpy/display/render.pyx":821
 * 
 *         # Stash and return the surface.
 *         if alpha:             # <<<<<<<<<<<<<<
 *             self.alpha_surface = rv
 *         else:
 */
    goto __pyx_L6;
  }

  /* "renpy/display/render.pyx":824
 *             self.alpha_surface = rv
 *         else:
 *             self.surface = rv             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  /*else*/ {
    __Pyx_INCREF(__pyx_v_rv);
    __Pyx_GIVEREF(__pyx_v_rv);
    __Pyx_GOTREF(__pyx_v_self->surface);
    __Pyx_DECREF(__pyx_v_self->surface);
    __pyx_v_self->surface = __pyx_v_rv;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":826
 *             self.surface = rv
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     pygame_surface = render_to_texture
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":797
 * 
 * 
 *     def render_to_texture(self, alpha=True):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a texture constructed from this render. This may return
 */

  /* 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.display.render.Render.render_to_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/display/render.pyx":830
 *     pygame_surface = render_to_texture
 * 
 *     def subsurface(self, rect, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a subsurface of this render. If `focus` is true, then
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_19subsurface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_18subsurface[] = "\n        Returns a subsurface of this render. If `focus` is true, then\n        the focuses are copied from this render to the child.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_19subsurface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("subsurface (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rect,&__pyx_n_s_focus,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_rect)) != 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_focus);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "subsurface") < 0)) __PYX_ERR(0, 830, __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_rect = values[0];
    __pyx_v_focus = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subsurface", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 830, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.subsurface", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_18subsurface(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_rect, __pyx_v_focus);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18subsurface(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_rect, PyObject *__pyx_v_focus) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_h = NULL;
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rv = NULL;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse = NULL;
  PyObject *__pyx_v_tx = NULL;
  PyObject *__pyx_v_ty = NULL;
  PyObject *__pyx_v_tw = NULL;
  PyObject *__pyx_v_th = NULL;
  PyObject *__pyx_v_rw = NULL;
  PyObject *__pyx_v_rh = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_cx = NULL;
  PyObject *__pyx_v_cy = NULL;
  PyObject *__pyx_v_cfocus = NULL;
  PyObject *__pyx_v_cmain = NULL;
  PyObject *__pyx_v_childw = NULL;
  PyObject *__pyx_v_childh = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_cw = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_ch = NULL;
  PyObject *__pyx_v_offset = NULL;
  PyObject *__pyx_v_crop = NULL;
  PyObject *__pyx_v_cropw = NULL;
  PyObject *__pyx_v_croph = NULL;
  PyObject *__pyx_v_newchild = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_fw = NULL;
  PyObject *__pyx_v_fh = NULL;
  PyObject *__pyx_v_mx = NULL;
  PyObject *__pyx_v_my = NULL;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v_mw = NULL;
  PyObject *__pyx_v_mh = NULL;
  PyObject *__pyx_v_mcx = NULL;
  PyObject *__pyx_v_mcy = 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)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  double __pyx_t_10;
  double __pyx_t_11;
  int __pyx_t_12;
  struct __pyx_opt_args_5renpy_7display_6render_6Render_blit __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  PyObject *__pyx_t_23 = NULL;
  PyObject *__pyx_t_24 = NULL;
  __Pyx_RefNannySetupContext("subsurface", 0);

  /* "renpy/display/render.pyx":836
 *         """
 * 
 *         (x, y, w, h) = rect             # <<<<<<<<<<<<<<
 *         rv = Render(w, h)
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_rect))) || (PyList_CheckExact(__pyx_v_rect))) {
    PyObject* sequence = __pyx_v_rect;
    #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, 836, __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_2 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_3,&__pyx_t_4};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 836, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_2,&__pyx_t_3,&__pyx_t_4};
    __pyx_t_5 = PyObject_GetIter(__pyx_v_rect); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_6(__pyx_t_5); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 4) < 0) __PYX_ERR(0, 836, __pyx_L1_error)
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 836, __pyx_L1_error)
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_w = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_h = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":837
 * 
 *         (x, y, w, h) = rect
 *         rv = Render(w, h)             # <<<<<<<<<<<<<<
 * 
 *         reverse = self.reverse
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_h);
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6render_Render), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 837, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_rv = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":839
 *         rv = Render(w, h)
 * 
 *         reverse = self.reverse             # <<<<<<<<<<<<<<
 * 
 *         # This code doesn't work. We need to do the clipping in the screen
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->reverse);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":872
 * #             rv.forward = Matrix2D(1.0 / xdx, 0.0, 0.0, 1.0 / ydy)
 * 
 *         if ((reverse is not None) and             # <<<<<<<<<<<<<<
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 */
  __pyx_t_8 = (((PyObject *)__pyx_v_reverse) != Py_None);
  __pyx_t_9 = (__pyx_t_8 != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }

  /* "renpy/display/render.pyx":873
 * 
 *         if ((reverse is not None) and
 *             (reverse.xdx != 1.0 or             # <<<<<<<<<<<<<<
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or
 */
  __pyx_t_9 = ((__pyx_v_reverse->xdx != 1.0) != 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }

  /* "renpy/display/render.pyx":874
 *         if ((reverse is not None) and
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or             # <<<<<<<<<<<<<<
 *             reverse.ydx != 0.0 or
 *             reverse.ydy != 1.0)):
 */
  __pyx_t_9 = ((__pyx_v_reverse->xdy != 0.0) != 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }

  /* "renpy/display/render.pyx":875
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or             # <<<<<<<<<<<<<<
 *             reverse.ydy != 1.0)):
 * 
 */
  __pyx_t_9 = ((__pyx_v_reverse->ydx != 0.0) != 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }

  /* "renpy/display/render.pyx":876
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or
 *             reverse.ydy != 1.0)):             # <<<<<<<<<<<<<<
 * 
 *             # This doesn't actually make a subsurface, as we can't easily do
 */
  __pyx_t_9 = ((__pyx_v_reverse->ydy != 1.0) != 0);
  __pyx_t_7 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;

  /* "renpy/display/render.pyx":872
 * #             rv.forward = Matrix2D(1.0 / xdx, 0.0, 0.0, 1.0 / ydy)
 * 
 *         if ((reverse is not None) and             # <<<<<<<<<<<<<<
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 */
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":881
 *             # so for non-rectangle-aligned renders.
 * 
 *             rv.xclipping = True             # <<<<<<<<<<<<<<
 *             rv.yclipping = True
 * 
 */
    __pyx_v_rv->xclipping = 1;

    /* "renpy/display/render.pyx":882
 * 
 *             rv.xclipping = True
 *             rv.yclipping = True             # <<<<<<<<<<<<<<
 * 
 *             # Try to avoid clipping if a surface fits entirely inside the
 */
    __pyx_v_rv->yclipping = 1;

    /* "renpy/display/render.pyx":887
 *             # rectangle.
 * 
 *             if (reverse.xdx > 0.0 and             # <<<<<<<<<<<<<<
 *                 reverse.xdy == 0.0 and
 *                 reverse.ydx == 0.0 and
 */
    __pyx_t_9 = ((__pyx_v_reverse->xdx > 0.0) != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L12_bool_binop_done;
    }

    /* "renpy/display/render.pyx":888
 * 
 *             if (reverse.xdx > 0.0 and
 *                 reverse.xdy == 0.0 and             # <<<<<<<<<<<<<<
 *                 reverse.ydx == 0.0 and
 *                 reverse.ydy > 0.0):
 */
    __pyx_t_9 = ((__pyx_v_reverse->xdy == 0.0) != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L12_bool_binop_done;
    }

    /* "renpy/display/render.pyx":889
 *             if (reverse.xdx > 0.0 and
 *                 reverse.xdy == 0.0 and
 *                 reverse.ydx == 0.0 and             # <<<<<<<<<<<<<<
 *                 reverse.ydy > 0.0):
 * 
 */
    __pyx_t_9 = ((__pyx_v_reverse->ydx == 0.0) != 0);
    if (__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L12_bool_binop_done;
    }

    /* "renpy/display/render.pyx":890
 *                 reverse.xdy == 0.0 and
 *                 reverse.ydx == 0.0 and
 *                 reverse.ydy > 0.0):             # <<<<<<<<<<<<<<
 * 
 *                 tx, ty = self.forward.transform(x, y)
 */
    __pyx_t_9 = ((__pyx_v_reverse->ydy > 0.0) != 0);
    __pyx_t_7 = __pyx_t_9;
    __pyx_L12_bool_binop_done:;

    /* "renpy/display/render.pyx":887
 *             # rectangle.
 * 
 *             if (reverse.xdx > 0.0 and             # <<<<<<<<<<<<<<
 *                 reverse.xdy == 0.0 and
 *                 reverse.ydx == 0.0 and
 */
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":892
 *                 reverse.ydy > 0.0):
 * 
 *                 tx, ty = self.forward.transform(x, y)             # <<<<<<<<<<<<<<
 *                 tw, th = self.forward.transform(w + x, h + y)
 *                 rw, rh = self.forward.transform(self.width, self.height)
 */
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_v_x); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 892, __pyx_L1_error)
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_y); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 892, __pyx_L1_error)
      __pyx_t_3 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_self->forward->__pyx_vtab)->transform(__pyx_v_self->forward, __pyx_t_10, __pyx_t_11, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(__pyx_t_3 != Py_None)) {
        PyObject* sequence = __pyx_t_3;
        #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, 892, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 892, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 892, __pyx_L1_error)
      }
      __pyx_v_tx = __pyx_t_4;
      __pyx_t_4 = 0;
      __pyx_v_ty = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "renpy/display/render.pyx":893
 * 
 *                 tx, ty = self.forward.transform(x, y)
 *                 tw, th = self.forward.transform(w + x, h + y)             # <<<<<<<<<<<<<<
 *                 rw, rh = self.forward.transform(self.width, self.height)
 * 
 */
      __pyx_t_3 = PyNumber_Add(__pyx_v_w, __pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyNumber_Add(__pyx_v_h, __pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_self->forward->__pyx_vtab)->transform(__pyx_v_self->forward, __pyx_t_11, __pyx_t_10, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 893, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(__pyx_t_3 != Py_None)) {
        PyObject* sequence = __pyx_t_3;
        #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, 893, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        #else
        __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 893, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 893, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 893, __pyx_L1_error)
      }
      __pyx_v_tw = __pyx_t_2;
      __pyx_t_2 = 0;
      __pyx_v_th = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":894
 *                 tx, ty = self.forward.transform(x, y)
 *                 tw, th = self.forward.transform(w + x, h + y)
 *                 rw, rh = self.forward.transform(self.width, self.height)             # <<<<<<<<<<<<<<
 * 
 *                 if (tx <= 0) and (tw >= rw):
 */
      __pyx_t_3 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_self->forward->__pyx_vtab)->transform(__pyx_v_self->forward, __pyx_v_self->width, __pyx_v_self->height, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (likely(__pyx_t_3 != Py_None)) {
        PyObject* sequence = __pyx_t_3;
        #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, 894, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 894, __pyx_L1_error)
      }
      __pyx_v_rw = __pyx_t_4;
      __pyx_t_4 = 0;
      __pyx_v_rh = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "renpy/display/render.pyx":896
 *                 rw, rh = self.forward.transform(self.width, self.height)
 * 
 *                 if (tx <= 0) and (tw >= rw):             # <<<<<<<<<<<<<<
 *                     rv.xclipping = False
 * 
 */
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_tx, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 896, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_9) {
      } else {
        __pyx_t_7 = __pyx_t_9;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_tw, __pyx_v_rw, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 896, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 896, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __pyx_t_9;
      __pyx_L17_bool_binop_done:;
      if (__pyx_t_7) {

        /* "renpy/display/render.pyx":897
 * 
 *                 if (tx <= 0) and (tw >= rw):
 *                     rv.xclipping = False             # <<<<<<<<<<<<<<
 * 
 *                 if (ty <= 0) and (th >= rh):
 */
        __pyx_v_rv->xclipping = 0;

        /* "renpy/display/render.pyx":896
 *                 rw, rh = self.forward.transform(self.width, self.height)
 * 
 *                 if (tx <= 0) and (tw >= rw):             # <<<<<<<<<<<<<<
 *                     rv.xclipping = False
 * 
 */
      }

      /* "renpy/display/render.pyx":899
 *                     rv.xclipping = False
 * 
 *                 if (ty <= 0) and (th >= rh):             # <<<<<<<<<<<<<<
 *                     rv.yclipping = False
 * 
 */
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_ty, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 899, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_9) {
      } else {
        __pyx_t_7 = __pyx_t_9;
        goto __pyx_L20_bool_binop_done;
      }
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_th, __pyx_v_rh, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 899, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __pyx_t_9;
      __pyx_L20_bool_binop_done:;
      if (__pyx_t_7) {

        /* "renpy/display/render.pyx":900
 * 
 *                 if (ty <= 0) and (th >= rh):
 *                     rv.yclipping = False             # <<<<<<<<<<<<<<
 * 
 *             rv.blit(self, (-x, -y), focus=focus, main=True)
 */
        __pyx_v_rv->yclipping = 0;

        /* "renpy/display/render.pyx":899
 *                     rv.xclipping = False
 * 
 *                 if (ty <= 0) and (th >= rh):             # <<<<<<<<<<<<<<
 *                     rv.yclipping = False
 * 
 */
      }

      /* "renpy/display/render.pyx":887
 *             # rectangle.
 * 
 *             if (reverse.xdx > 0.0 and             # <<<<<<<<<<<<<<
 *                 reverse.xdy == 0.0 and
 *                 reverse.ydx == 0.0 and
 */
    }

    /* "renpy/display/render.pyx":902
 *                     rv.yclipping = False
 * 
 *             rv.blit(self, (-x, -y), focus=focus, main=True)             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
    __pyx_t_3 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Negative(__pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 902, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_13.__pyx_n = 2;
    __pyx_t_13.focus = __pyx_v_focus;
    __pyx_t_13.main = Py_True;
    __pyx_t_12 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)__pyx_v_rv->__pyx_vtab)->blit(__pyx_v_rv, ((PyObject *)__pyx_v_self), ((PyObject*)__pyx_t_4), 0, &__pyx_t_13); 
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":903
 * 
 *             rv.blit(self, (-x, -y), focus=focus, main=True)
 *             return rv             # <<<<<<<<<<<<<<
 * 
 *         # This is the path that executes for rectangle-aligned surfaces,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_rv));
    __pyx_r = ((PyObject *)__pyx_v_rv);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":872
 * #             rv.forward = Matrix2D(1.0 / xdx, 0.0, 0.0, 1.0 / ydy)
 * 
 *         if ((reverse is not None) and             # <<<<<<<<<<<<<<
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 */
  }

  /* "renpy/display/render.pyx":908
 *         # making an actual subsurface.
 * 
 *         for child, cx, cy, cfocus, cmain in self.children:             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(__pyx_v_self->children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 908, __pyx_L1_error)
  }
  __pyx_t_4 = __pyx_v_self->children; __Pyx_INCREF(__pyx_t_4); __pyx_t_14 = 0;
  for (;;) {
    if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_4)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_2); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 908, __pyx_L1_error)
    #else
    __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 908, __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, 908, __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_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_16 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_16 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_16);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_5,&__pyx_t_15,&__pyx_t_16};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 908, __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_3,&__pyx_t_1,&__pyx_t_5,&__pyx_t_15,&__pyx_t_16};
      __pyx_t_17 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 908, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_17)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_6(__pyx_t_17); if (unlikely(!item)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_17), 5) < 0) __PYX_ERR(0, 908, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      goto __pyx_L25_unpacking_done;
      __pyx_L24_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 908, __pyx_L1_error)
      __pyx_L25_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cfocus, __pyx_t_15);
    __pyx_t_15 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cmain, __pyx_t_16);
    __pyx_t_16 = 0;

    /* "renpy/display/render.pyx":911
 * 
 * 
 *             childw, childh = child.get_size()             # <<<<<<<<<<<<<<
 *             xo, cx, cw = compute_subline(cx, childw, x, w)
 *             yo, cy, ch = compute_subline(cy, childh, y, h)
 */
    __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_get_size); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 911, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_15 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_16))) {
      __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16);
      if (likely(__pyx_t_15)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_16, function);
      }
    }
    if (__pyx_t_15) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_15); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 911, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 911, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 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, 911, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_16 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_15);
      #else
      __pyx_t_16 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 911, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 911, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 911, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_16 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_16)) goto __pyx_L26_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_16);
      index = 1; __pyx_t_15 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_15)) goto __pyx_L26_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) __PYX_ERR(0, 911, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L27_unpacking_done;
      __pyx_L26_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 911, __pyx_L1_error)
      __pyx_L27_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_childw, __pyx_t_16);
    __pyx_t_16 = 0;
    __Pyx_XDECREF_SET(__pyx_v_childh, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "renpy/display/render.pyx":912
 * 
 *             childw, childh = child.get_size()
 *             xo, cx, cw = compute_subline(cx, childw, x, w)             # <<<<<<<<<<<<<<
 *             yo, cy, ch = compute_subline(cy, childh, y, h)
 * 
 */
    __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_compute_subline); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 912, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_16 = NULL;
    __pyx_t_12 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_15))) {
      __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
      if (likely(__pyx_t_16)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_15, function);
        __pyx_t_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[5] = {__pyx_t_16, __pyx_v_cx, __pyx_v_childw, __pyx_v_x, __pyx_v_w};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
      PyObject *__pyx_temp[5] = {__pyx_t_16, __pyx_v_cx, __pyx_v_childw, __pyx_v_x, __pyx_v_w};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_5 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_16) {
        __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_16); __pyx_t_16 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cx);
      __Pyx_GIVEREF(__pyx_v_cx);
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_v_cx);
      __Pyx_INCREF(__pyx_v_childw);
      __Pyx_GIVEREF(__pyx_v_childw);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, __pyx_v_childw);
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_12, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_w);
      __Pyx_GIVEREF(__pyx_v_w);
      PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_12, __pyx_v_w);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 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 != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 912, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_16 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_16 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_16);
      #else
      __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_16 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      #endif
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_15 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_15)) goto __pyx_L28_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L28_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_16 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_16)) goto __pyx_L28_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_16);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 3) < 0) __PYX_ERR(0, 912, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L29_unpacking_done;
      __pyx_L28_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 912, __pyx_L1_error)
      __pyx_L29_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_15);
    __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_cx, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cw, __pyx_t_16);
    __pyx_t_16 = 0;

    /* "renpy/display/render.pyx":913
 *             childw, childh = child.get_size()
 *             xo, cx, cw = compute_subline(cx, childw, x, w)
 *             yo, cy, ch = compute_subline(cy, childh, y, h)             # <<<<<<<<<<<<<<
 * 
 *             if cw <= 0 or ch <= 0 or w - xo <= 0 or h - yo <= 0:
 */
    __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_compute_subline); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 913, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_16);
    __pyx_t_5 = NULL;
    __pyx_t_12 = 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_12 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_16)) {
      PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_cy, __pyx_v_childh, __pyx_v_y, __pyx_v_h};
      __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __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_16)) {
      PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_cy, __pyx_v_childh, __pyx_v_y, __pyx_v_h};
      __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_2);
    } else
    #endif
    {
      __pyx_t_15 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cy);
      __Pyx_GIVEREF(__pyx_v_cy);
      PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_12, __pyx_v_cy);
      __Pyx_INCREF(__pyx_v_childh);
      __Pyx_GIVEREF(__pyx_v_childh);
      PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_12, __pyx_v_childh);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_12, __pyx_v_y);
      __Pyx_INCREF(__pyx_v_h);
      __Pyx_GIVEREF(__pyx_v_h);
      PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_12, __pyx_v_h);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
    __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 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 != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 913, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_16 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_5);
      #else
      __pyx_t_16 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __pyx_t_15 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_5 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 913, __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_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 913, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_16 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_16)) goto __pyx_L30_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_16);
      index = 1; __pyx_t_15 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_15)) goto __pyx_L30_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 2; __pyx_t_5 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_5)) goto __pyx_L30_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 3) < 0) __PYX_ERR(0, 913, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L31_unpacking_done;
      __pyx_L30_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 913, __pyx_L1_error)
      __pyx_L31_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_16);
    __pyx_t_16 = 0;
    __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_15);
    __pyx_t_15 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ch, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":915
 *             yo, cy, ch = compute_subline(cy, childh, y, h)
 * 
 *             if cw <= 0 or ch <= 0 or w - xo <= 0 or h - yo <= 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_cw, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L33_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_ch, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L33_bool_binop_done;
    }
    __pyx_t_2 = PyNumber_Subtract(__pyx_v_w, __pyx_v_xo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L33_bool_binop_done;
    }
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_h, __pyx_v_yo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 915, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __pyx_t_9;
    __pyx_L33_bool_binop_done:;
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":916
 * 
 *             if cw <= 0 or ch <= 0 or w - xo <= 0 or h - yo <= 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             if cx < 0 or cx >= childw or cy < 0 or cy >= childh:
 */
      goto __pyx_L22_continue;

      /* "renpy/display/render.pyx":915
 *             yo, cy, ch = compute_subline(cy, childh, y, h)
 * 
 *             if cw <= 0 or ch <= 0 or w - xo <= 0 or h - yo <= 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":918
 *                 continue
 * 
 *             if cx < 0 or cx >= childw or cy < 0 or cy >= childh:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_cx, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_cx, __pyx_v_childw, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_cy, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (!__pyx_t_9) {
    } else {
      __pyx_t_7 = __pyx_t_9;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_v_cy, __pyx_v_childh, Py_GE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 918, __pyx_L1_error)
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 918, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = __pyx_t_9;
    __pyx_L38_bool_binop_done:;
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":919
 * 
 *             if cx < 0 or cx >= childw or cy < 0 or cy >= childh:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             offset = (xo, yo)
 */
      goto __pyx_L22_continue;

      /* "renpy/display/render.pyx":918
 *                 continue
 * 
 *             if cx < 0 or cx >= childw or cy < 0 or cy >= childh:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":921
 *                 continue
 * 
 *             offset = (xo, yo)             # <<<<<<<<<<<<<<
 *             crop = None
 * 
 */
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_yo);
    __Pyx_XDECREF_SET(__pyx_v_offset, ((PyObject*)__pyx_t_2));
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":922
 * 
 *             offset = (xo, yo)
 *             crop = None             # <<<<<<<<<<<<<<
 * 
 *             try:
 */
    __Pyx_INCREF(Py_None);
    __Pyx_XDECREF_SET(__pyx_v_crop, Py_None);

    /* "renpy/display/render.pyx":924
 *             crop = None
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, Render):
 * 
 */
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_20);
      /*try:*/ {

        /* "renpy/display/render.pyx":925
 * 
 *             try:
 *                 if isinstance(child, Render):             # <<<<<<<<<<<<<<
 * 
 *                     if child.xclipping:
 */
        __pyx_t_7 = __Pyx_TypeCheck(__pyx_v_child, __pyx_ptype_5renpy_7display_6render_Render); 
        __pyx_t_9 = (__pyx_t_7 != 0);
        if (__pyx_t_9) {

          /* "renpy/display/render.pyx":927
 *                 if isinstance(child, Render):
 * 
 *                     if child.xclipping:             # <<<<<<<<<<<<<<
 *                         cropw = cw
 *                     else:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_xclipping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 927, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 927, __pyx_L42_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_9) {

            /* "renpy/display/render.pyx":928
 * 
 *                     if child.xclipping:
 *                         cropw = cw             # <<<<<<<<<<<<<<
 *                     else:
 *                         cropw = w - xo
 */
            __Pyx_INCREF(__pyx_v_cw);
            __Pyx_XDECREF_SET(__pyx_v_cropw, __pyx_v_cw);

            /* "renpy/display/render.pyx":927
 *                 if isinstance(child, Render):
 * 
 *                     if child.xclipping:             # <<<<<<<<<<<<<<
 *                         cropw = cw
 *                     else:
 */
            goto __pyx_L51;
          }

          /* "renpy/display/render.pyx":930
 *                         cropw = cw
 *                     else:
 *                         cropw = w - xo             # <<<<<<<<<<<<<<
 * 
 *                     if child.yclipping:
 */
          /*else*/ {
            __pyx_t_2 = PyNumber_Subtract(__pyx_v_w, __pyx_v_xo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 930, __pyx_L42_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF_SET(__pyx_v_cropw, __pyx_t_2);
            __pyx_t_2 = 0;
          }
          __pyx_L51:;

          /* "renpy/display/render.pyx":932
 *                         cropw = w - xo
 * 
 *                     if child.yclipping:             # <<<<<<<<<<<<<<
 *                         croph = ch
 *                     else:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_yclipping); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 932, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 932, __pyx_L42_error)
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          if (__pyx_t_9) {

            /* "renpy/display/render.pyx":933
 * 
 *                     if child.yclipping:
 *                         croph = ch             # <<<<<<<<<<<<<<
 *                     else:
 *                         croph = h - yo
 */
            __Pyx_INCREF(__pyx_v_ch);
            __Pyx_XDECREF_SET(__pyx_v_croph, __pyx_v_ch);

            /* "renpy/display/render.pyx":932
 *                         cropw = w - xo
 * 
 *                     if child.yclipping:             # <<<<<<<<<<<<<<
 *                         croph = ch
 *                     else:
 */
            goto __pyx_L52;
          }

          /* "renpy/display/render.pyx":935
 *                         croph = ch
 *                     else:
 *                         croph = h - yo             # <<<<<<<<<<<<<<
 * 
 *                     crop = (cx, cy, cropw, croph)
 */
          /*else*/ {
            __pyx_t_2 = PyNumber_Subtract(__pyx_v_h, __pyx_v_yo); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 935, __pyx_L42_error)
            __Pyx_GOTREF(__pyx_t_2);
            __Pyx_XDECREF_SET(__pyx_v_croph, __pyx_t_2);
            __pyx_t_2 = 0;
          }
          __pyx_L52:;

          /* "renpy/display/render.pyx":937
 *                         croph = h - yo
 * 
 *                     crop = (cx, cy, cropw, croph)             # <<<<<<<<<<<<<<
 *                     newchild = child.subsurface(crop, focus=focus)
 *                     newchild.width = cw
 */
          __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 937, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_INCREF(__pyx_v_cx);
          __Pyx_GIVEREF(__pyx_v_cx);
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_cx);
          __Pyx_INCREF(__pyx_v_cy);
          __Pyx_GIVEREF(__pyx_v_cy);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_cy);
          __Pyx_INCREF(__pyx_v_cropw);
          __Pyx_GIVEREF(__pyx_v_cropw);
          PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_cropw);
          __Pyx_INCREF(__pyx_v_croph);
          __Pyx_GIVEREF(__pyx_v_croph);
          PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_croph);
          __Pyx_DECREF_SET(__pyx_v_crop, __pyx_t_2);
          __pyx_t_2 = 0;

          /* "renpy/display/render.pyx":938
 * 
 *                     crop = (cx, cy, cropw, croph)
 *                     newchild = child.subsurface(crop, focus=focus)             # <<<<<<<<<<<<<<
 *                     newchild.width = cw
 *                     newchild.height = ch
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 938, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 938, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_INCREF(__pyx_v_crop);
          __Pyx_GIVEREF(__pyx_v_crop);
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_crop);
          __pyx_t_15 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 938, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_15);
          if (PyDict_SetItem(__pyx_t_15, __pyx_n_s_focus, __pyx_v_focus) < 0) __PYX_ERR(0, 938, __pyx_L42_error)
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 938, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_XDECREF_SET(__pyx_v_newchild, __pyx_t_16);
          __pyx_t_16 = 0;

          /* "renpy/display/render.pyx":939
 *                     crop = (cx, cy, cropw, croph)
 *                     newchild = child.subsurface(crop, focus=focus)
 *                     newchild.width = cw             # <<<<<<<<<<<<<<
 *                     newchild.height = ch
 *                     newchild.render_of = child.render_of[:]
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_newchild, __pyx_n_s_width, __pyx_v_cw) < 0) __PYX_ERR(0, 939, __pyx_L42_error)

          /* "renpy/display/render.pyx":940
 *                     newchild = child.subsurface(crop, focus=focus)
 *                     newchild.width = cw
 *                     newchild.height = ch             # <<<<<<<<<<<<<<
 *                     newchild.render_of = child.render_of[:]
 * 
 */
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_newchild, __pyx_n_s_height, __pyx_v_ch) < 0) __PYX_ERR(0, 940, __pyx_L42_error)

          /* "renpy/display/render.pyx":941
 *                     newchild.width = cw
 *                     newchild.height = ch
 *                     newchild.render_of = child.render_of[:]             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_render_of); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 941, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_15 = __Pyx_PyObject_GetSlice(__pyx_t_16, 0, 0, NULL, NULL, &__pyx_slice__6, 0, 0, 1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 941, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (__Pyx_PyObject_SetAttrStr(__pyx_v_newchild, __pyx_n_s_render_of, __pyx_t_15) < 0) __PYX_ERR(0, 941, __pyx_L42_error)
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;

          /* "renpy/display/render.pyx":925
 * 
 *             try:
 *                 if isinstance(child, Render):             # <<<<<<<<<<<<<<
 * 
 *                     if child.xclipping:
 */
          goto __pyx_L50;
        }

        /* "renpy/display/render.pyx":945
 *                 else:
 * 
 *                     crop = (cx, cy, cw, ch)             # <<<<<<<<<<<<<<
 *                     newchild = child.subsurface(crop)
 *                     renpy.display.draw.mutated_surface(newchild)
 */
        /*else*/ {
          __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 945, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_v_cx);
          __Pyx_GIVEREF(__pyx_v_cx);
          PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_cx);
          __Pyx_INCREF(__pyx_v_cy);
          __Pyx_GIVEREF(__pyx_v_cy);
          PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_cy);
          __Pyx_INCREF(__pyx_v_cw);
          __Pyx_GIVEREF(__pyx_v_cw);
          PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_cw);
          __Pyx_INCREF(__pyx_v_ch);
          __Pyx_GIVEREF(__pyx_v_ch);
          PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_ch);
          __Pyx_DECREF_SET(__pyx_v_crop, __pyx_t_15);
          __pyx_t_15 = 0;

          /* "renpy/display/render.pyx":946
 * 
 *                     crop = (cx, cy, cw, ch)
 *                     newchild = child.subsurface(crop)             # <<<<<<<<<<<<<<
 *                     renpy.display.draw.mutated_surface(newchild)
 * 
 */
          __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 946, __pyx_L42_error)
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_5 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(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);
            }
          }
          if (!__pyx_t_5) {
            __pyx_t_15 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_v_crop); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 946, __pyx_L42_error)
            __Pyx_GOTREF(__pyx_t_15);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_16)) {
              PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_crop};
              __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 946, __pyx_L42_error)
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_GOTREF(__pyx_t_15);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
              PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_crop};
              __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 946, __pyx_L42_error)
              __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
              __Pyx_GOTREF(__pyx_t_15);
            } else
            #endif
            {
              __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 946, __pyx_L42_error)
              __Pyx_GOTREF(__pyx_t_2);
              __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
              __Pyx_INCREF(__pyx_v_crop);
              __Pyx_GIVEREF(__pyx_v_crop);
              PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_crop);
              __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_2, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 946, __pyx_L42_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          __Pyx_XDECREF_SET(__pyx_v_newchild, __pyx_t_15);
          __pyx_t_15 = 0;

          /* "renpy/display/render.pyx":947
 *                     crop = (cx, cy, cw, ch)
 *                     newchild = child.subsurface(crop)
 *                     renpy.display.draw.mutated_surface(newchild)             # <<<<<<<<<<<<<<
 * 
 *             except:
 */
          __pyx_t_16 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 947, __pyx_L42_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, 947, __pyx_L42_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_draw); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 947, __pyx_L42_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_mutated_surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 947, __pyx_L42_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_15 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_newchild); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 947, __pyx_L42_error)
            __Pyx_GOTREF(__pyx_t_15);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_v_newchild};
              __pyx_t_15 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 947, __pyx_L42_error)
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_GOTREF(__pyx_t_15);
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
              PyObject *__pyx_temp[2] = {__pyx_t_16, __pyx_v_newchild};
              __pyx_t_15 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 947, __pyx_L42_error)
              __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
              __Pyx_GOTREF(__pyx_t_15);
            } else
            #endif
            {
              __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 947, __pyx_L42_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_INCREF(__pyx_v_newchild);
              __Pyx_GIVEREF(__pyx_v_newchild);
              PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_newchild);
              __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 947, __pyx_L42_error)
              __Pyx_GOTREF(__pyx_t_15);
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        }
        __pyx_L50:;

        /* "renpy/display/render.pyx":924
 *             crop = None
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, Render):
 * 
 */
      }
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
      goto __pyx_L49_try_end;
      __pyx_L42_error:;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;

      /* "renpy/display/render.pyx":949
 *                     renpy.display.draw.mutated_surface(newchild)
 * 
 *             except:             # <<<<<<<<<<<<<<
 *                 raise Exception("Creating subsurface failed. child size = ({}, {}), crop = {!r}".format(childw, childh, crop))
 * 
 */
      /*except:*/ {
        __Pyx_AddTraceback("renpy.display.render.Render.subsurface", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_15, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 949, __pyx_L44_except_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_5);

        /* "renpy/display/render.pyx":950
 * 
 *             except:
 *                 raise Exception("Creating subsurface failed. child size = ({}, {}), crop = {!r}".format(childw, childh, crop))             # <<<<<<<<<<<<<<
 * 
 *             rv.blit(newchild, offset, focus=cfocus, main=cmain)
 */
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Creating_subsurface_failed_child, __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L44_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_3 = NULL;
        __pyx_t_12 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_1, function);
            __pyx_t_12 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_childw, __pyx_v_childh, __pyx_v_crop};
          __pyx_t_16 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 950, __pyx_L44_except_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_16);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
          PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_v_childw, __pyx_v_childh, __pyx_v_crop};
          __pyx_t_16 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 950, __pyx_L44_except_error)
          __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_GOTREF(__pyx_t_16);
        } else
        #endif
        {
          __pyx_t_17 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 950, __pyx_L44_except_error)
          __Pyx_GOTREF(__pyx_t_17);
          if (__pyx_t_3) {
            __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_3); __pyx_t_3 = NULL;
          }
          __Pyx_INCREF(__pyx_v_childw);
          __Pyx_GIVEREF(__pyx_v_childw);
          PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_12, __pyx_v_childw);
          __Pyx_INCREF(__pyx_v_childh);
          __Pyx_GIVEREF(__pyx_v_childh);
          PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_12, __pyx_v_childh);
          __Pyx_INCREF(__pyx_v_crop);
          __Pyx_GIVEREF(__pyx_v_crop);
          PyTuple_SET_ITEM(__pyx_t_17, 2+__pyx_t_12, __pyx_v_crop);
          __pyx_t_16 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_17, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 950, __pyx_L44_except_error)
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        }
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 950, __pyx_L44_except_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_16);
        PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_16);
        __pyx_t_16 = 0;
        __pyx_t_16 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 950, __pyx_L44_except_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_Raise(__pyx_t_16, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __PYX_ERR(0, 950, __pyx_L44_except_error)
      }
      __pyx_L44_except_error:;

      /* "renpy/display/render.pyx":924
 *             crop = None
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, Render):
 * 
 */
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_XGIVEREF(__pyx_t_19);
      __Pyx_XGIVEREF(__pyx_t_20);
      __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
      goto __pyx_L1_error;
      __pyx_L49_try_end:;
    }

    /* "renpy/display/render.pyx":952
 *                 raise Exception("Creating subsurface failed. child size = ({}, {}), crop = {!r}".format(childw, childh, crop))
 * 
 *             rv.blit(newchild, offset, focus=cfocus, main=cmain)             # <<<<<<<<<<<<<<
 * 
 *         if focus and self.focuses:
 */
    __pyx_t_13.__pyx_n = 2;
    __pyx_t_13.focus = __pyx_v_cfocus;
    __pyx_t_13.main = __pyx_v_cmain;
    __pyx_t_12 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)__pyx_v_rv->__pyx_vtab)->blit(__pyx_v_rv, __pyx_v_newchild, __pyx_v_offset, 0, &__pyx_t_13); 

    /* "renpy/display/render.pyx":908
 *         # making an actual subsurface.
 * 
 *         for child, cx, cy, cfocus, cmain in self.children:             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_L22_continue:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":954
 *             rv.blit(newchild, offset, focus=cfocus, main=cmain)
 * 
 *         if focus and self.focuses:             # <<<<<<<<<<<<<<
 * 
 *             for (d, arg, xo, yo, fw, fh, mx, my, mask) in self.focuses:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 954, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_9 = __pyx_t_7;
    goto __pyx_L56_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_self->focuses != Py_None) && (PyList_GET_SIZE(__pyx_v_self->focuses) != 0);
  __pyx_t_9 = __pyx_t_7;
  __pyx_L56_bool_binop_done:;
  if (__pyx_t_9) {

    /* "renpy/display/render.pyx":956
 *         if focus and self.focuses:
 * 
 *             for (d, arg, xo, yo, fw, fh, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
    if (unlikely(__pyx_v_self->focuses == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 956, __pyx_L1_error)
    }
    __pyx_t_4 = __pyx_v_self->focuses; __Pyx_INCREF(__pyx_t_4); __pyx_t_14 = 0;
    for (;;) {
      if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_14); __Pyx_INCREF(__pyx_t_5); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 956, __pyx_L1_error)
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_4, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 9)) {
          if (size > 9) __Pyx_RaiseTooManyValuesError(9);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 956, __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_15 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_16 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_17 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_21 = PyTuple_GET_ITEM(sequence, 6); 
          __pyx_t_22 = PyTuple_GET_ITEM(sequence, 7); 
          __pyx_t_23 = PyTuple_GET_ITEM(sequence, 8); 
        } else {
          __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_16 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_1 = PyList_GET_ITEM(sequence, 3); 
          __pyx_t_17 = PyList_GET_ITEM(sequence, 4); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 5); 
          __pyx_t_21 = PyList_GET_ITEM(sequence, 6); 
          __pyx_t_22 = PyList_GET_ITEM(sequence, 7); 
          __pyx_t_23 = PyList_GET_ITEM(sequence, 8); 
        }
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_21);
        __Pyx_INCREF(__pyx_t_22);
        __Pyx_INCREF(__pyx_t_23);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[9] = {&__pyx_t_2,&__pyx_t_15,&__pyx_t_16,&__pyx_t_1,&__pyx_t_17,&__pyx_t_3,&__pyx_t_21,&__pyx_t_22,&__pyx_t_23};
          for (i=0; i < 9; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 956, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[9] = {&__pyx_t_2,&__pyx_t_15,&__pyx_t_16,&__pyx_t_1,&__pyx_t_17,&__pyx_t_3,&__pyx_t_21,&__pyx_t_22,&__pyx_t_23};
        __pyx_t_24 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 956, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_24);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_24)->tp_iternext;
        for (index=0; index < 9; index++) {
          PyObject* item = __pyx_t_6(__pyx_t_24); if (unlikely(!item)) goto __pyx_L60_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_24), 9) < 0) __PYX_ERR(0, 956, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        goto __pyx_L61_unpacking_done;
        __pyx_L60_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 956, __pyx_L1_error)
        __pyx_L61_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_15);
      __pyx_t_15 = 0;
      __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_16);
      __pyx_t_16 = 0;
      __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_fw, __pyx_t_17);
      __pyx_t_17 = 0;
      __Pyx_XDECREF_SET(__pyx_v_fh, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mx, __pyx_t_21);
      __pyx_t_21 = 0;
      __Pyx_XDECREF_SET(__pyx_v_my, __pyx_t_22);
      __pyx_t_22 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mask, __pyx_t_23);
      __pyx_t_23 = 0;

      /* "renpy/display/render.pyx":958
 *             for (d, arg, xo, yo, fw, fh, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 *                     continue
 */
      __pyx_t_9 = (__pyx_v_xo == Py_None);
      __pyx_t_7 = (__pyx_t_9 != 0);
      if (__pyx_t_7) {

        /* "renpy/display/render.pyx":959
 * 
 *                 if xo is None:
 *                     rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_t_23 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_add_focus); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 959, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_23);
        __pyx_t_22 = NULL;
        __pyx_t_12 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_23))) {
          __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_23);
          if (likely(__pyx_t_22)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
            __Pyx_INCREF(__pyx_t_22);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_23, function);
            __pyx_t_12 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_23)) {
          PyObject *__pyx_temp[10] = {__pyx_t_22, __pyx_v_d, __pyx_v_arg, __pyx_v_xo, __pyx_v_yo, __pyx_v_fw, __pyx_v_fh, __pyx_v_mx, __pyx_v_my, __pyx_v_mask};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_12, 9+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 959, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
          PyObject *__pyx_temp[10] = {__pyx_t_22, __pyx_v_d, __pyx_v_arg, __pyx_v_xo, __pyx_v_yo, __pyx_v_fw, __pyx_v_fh, __pyx_v_mx, __pyx_v_my, __pyx_v_mask};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_12, 9+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 959, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_21 = PyTuple_New(9+__pyx_t_12); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          if (__pyx_t_22) {
            __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_22); __pyx_t_22 = NULL;
          }
          __Pyx_INCREF(__pyx_v_d);
          __Pyx_GIVEREF(__pyx_v_d);
          PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_12, __pyx_v_d);
          __Pyx_INCREF(__pyx_v_arg);
          __Pyx_GIVEREF(__pyx_v_arg);
          PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_12, __pyx_v_arg);
          __Pyx_INCREF(__pyx_v_xo);
          __Pyx_GIVEREF(__pyx_v_xo);
          PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_12, __pyx_v_xo);
          __Pyx_INCREF(__pyx_v_yo);
          __Pyx_GIVEREF(__pyx_v_yo);
          PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_12, __pyx_v_yo);
          __Pyx_INCREF(__pyx_v_fw);
          __Pyx_GIVEREF(__pyx_v_fw);
          PyTuple_SET_ITEM(__pyx_t_21, 4+__pyx_t_12, __pyx_v_fw);
          __Pyx_INCREF(__pyx_v_fh);
          __Pyx_GIVEREF(__pyx_v_fh);
          PyTuple_SET_ITEM(__pyx_t_21, 5+__pyx_t_12, __pyx_v_fh);
          __Pyx_INCREF(__pyx_v_mx);
          __Pyx_GIVEREF(__pyx_v_mx);
          PyTuple_SET_ITEM(__pyx_t_21, 6+__pyx_t_12, __pyx_v_mx);
          __Pyx_INCREF(__pyx_v_my);
          __Pyx_GIVEREF(__pyx_v_my);
          PyTuple_SET_ITEM(__pyx_t_21, 7+__pyx_t_12, __pyx_v_my);
          __Pyx_INCREF(__pyx_v_mask);
          __Pyx_GIVEREF(__pyx_v_mask);
          PyTuple_SET_ITEM(__pyx_t_21, 8+__pyx_t_12, __pyx_v_mask);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_21, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 959, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        }
        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "renpy/display/render.pyx":960
 *                 if xo is None:
 *                     rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 xo, cx, fw = compute_subline(xo, fw, x, w)
 */
        goto __pyx_L58_continue;

        /* "renpy/display/render.pyx":958
 *             for (d, arg, xo, yo, fw, fh, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 *                     continue
 */
      }

      /* "renpy/display/render.pyx":962
 *                     continue
 * 
 *                 xo, cx, fw = compute_subline(xo, fw, x, w)             # <<<<<<<<<<<<<<
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)
 * 
 */
      __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s_compute_subline); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 962, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_23);
      __pyx_t_21 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
        __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_23);
        if (likely(__pyx_t_21)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_23, function);
          __pyx_t_12 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_23)) {
        PyObject *__pyx_temp[5] = {__pyx_t_21, __pyx_v_xo, __pyx_v_fw, __pyx_v_x, __pyx_v_w};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
        PyObject *__pyx_temp[5] = {__pyx_t_21, __pyx_v_xo, __pyx_v_fw, __pyx_v_x, __pyx_v_w};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_22 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_22);
        if (__pyx_t_21) {
          __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_21); __pyx_t_21 = NULL;
        }
        __Pyx_INCREF(__pyx_v_xo);
        __Pyx_GIVEREF(__pyx_v_xo);
        PyTuple_SET_ITEM(__pyx_t_22, 0+__pyx_t_12, __pyx_v_xo);
        __Pyx_INCREF(__pyx_v_fw);
        __Pyx_GIVEREF(__pyx_v_fw);
        PyTuple_SET_ITEM(__pyx_t_22, 1+__pyx_t_12, __pyx_v_fw);
        __Pyx_INCREF(__pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_22, 2+__pyx_t_12, __pyx_v_x);
        __Pyx_INCREF(__pyx_v_w);
        __Pyx_GIVEREF(__pyx_v_w);
        PyTuple_SET_ITEM(__pyx_t_22, 3+__pyx_t_12, __pyx_v_w);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_22, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
      }
      __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #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, 962, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_23 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_22 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_21 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_23 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_22 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_21 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_23);
        __Pyx_INCREF(__pyx_t_22);
        __Pyx_INCREF(__pyx_t_21);
        #else
        __pyx_t_23 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_23);
        __pyx_t_22 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_21 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
        index = 0; __pyx_t_23 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_23)) goto __pyx_L63_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_23);
        index = 1; __pyx_t_22 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_22)) goto __pyx_L63_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_22);
        index = 2; __pyx_t_21 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_21)) goto __pyx_L63_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_21);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 962, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L64_unpacking_done;
        __pyx_L63_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, 962, __pyx_L1_error)
        __pyx_L64_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_23);
      __pyx_t_23 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_22);
      __pyx_t_22 = 0;
      __Pyx_DECREF_SET(__pyx_v_fw, __pyx_t_21);
      __pyx_t_21 = 0;

      /* "renpy/display/render.pyx":963
 * 
 *                 xo, cx, fw = compute_subline(xo, fw, x, w)
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)             # <<<<<<<<<<<<<<
 * 
 *                 if fw <= 0 or fh <= 0:
 */
      __pyx_t_21 = __Pyx_GetModuleGlobalName(__pyx_n_s_compute_subline); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 963, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      __pyx_t_22 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
        __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_21);
        if (likely(__pyx_t_22)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_22);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_21, function);
          __pyx_t_12 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_21)) {
        PyObject *__pyx_temp[5] = {__pyx_t_22, __pyx_v_yo, __pyx_v_fh, __pyx_v_y, __pyx_v_h};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
        PyObject *__pyx_temp[5] = {__pyx_t_22, __pyx_v_yo, __pyx_v_fh, __pyx_v_y, __pyx_v_h};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_23 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_23);
        if (__pyx_t_22) {
          __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_22); __pyx_t_22 = NULL;
        }
        __Pyx_INCREF(__pyx_v_yo);
        __Pyx_GIVEREF(__pyx_v_yo);
        PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_12, __pyx_v_yo);
        __Pyx_INCREF(__pyx_v_fh);
        __Pyx_GIVEREF(__pyx_v_fh);
        PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_12, __pyx_v_fh);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_23, 2+__pyx_t_12, __pyx_v_y);
        __Pyx_INCREF(__pyx_v_h);
        __Pyx_GIVEREF(__pyx_v_h);
        PyTuple_SET_ITEM(__pyx_t_23, 3+__pyx_t_12, __pyx_v_h);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
      }
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #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, 963, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_21 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_23 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_22 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_21 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_23 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_22 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_21);
        __Pyx_INCREF(__pyx_t_23);
        __Pyx_INCREF(__pyx_t_22);
        #else
        __pyx_t_21 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        __pyx_t_23 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_23);
        __pyx_t_22 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_22);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 963, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
        index = 0; __pyx_t_21 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_21)) goto __pyx_L65_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_21);
        index = 1; __pyx_t_23 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_23)) goto __pyx_L65_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_23);
        index = 2; __pyx_t_22 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_22)) goto __pyx_L65_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_22);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 963, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L66_unpacking_done;
        __pyx_L65_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, 963, __pyx_L1_error)
        __pyx_L66_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_21);
      __pyx_t_21 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_23);
      __pyx_t_23 = 0;
      __Pyx_DECREF_SET(__pyx_v_fh, __pyx_t_22);
      __pyx_t_22 = 0;

      /* "renpy/display/render.pyx":965
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)
 * 
 *                 if fw <= 0 or fh <= 0:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_fw, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 965, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!__pyx_t_9) {
      } else {
        __pyx_t_7 = __pyx_t_9;
        goto __pyx_L68_bool_binop_done;
      }
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_fh, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 965, __pyx_L1_error)
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 965, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_7 = __pyx_t_9;
      __pyx_L68_bool_binop_done:;
      if (__pyx_t_7) {

        /* "renpy/display/render.pyx":966
 * 
 *                 if fw <= 0 or fh <= 0:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if mx is not None:
 */
        goto __pyx_L58_continue;

        /* "renpy/display/render.pyx":965
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)
 * 
 *                 if fw <= 0 or fh <= 0:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      }

      /* "renpy/display/render.pyx":968
 *                     continue
 * 
 *                 if mx is not None:             # <<<<<<<<<<<<<<
 * 
 *                     mw, mh = mask.get_size()
 */
      __pyx_t_7 = (__pyx_v_mx != Py_None);
      __pyx_t_9 = (__pyx_t_7 != 0);
      if (__pyx_t_9) {

        /* "renpy/display/render.pyx":970
 *                 if mx is not None:
 * 
 *                     mw, mh = mask.get_size()             # <<<<<<<<<<<<<<
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)
 */
        __pyx_t_22 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s_get_size); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 970, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_23 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_22))) {
          __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22);
          if (likely(__pyx_t_23)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
            __Pyx_INCREF(__pyx_t_23);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_22, function);
          }
        }
        if (__pyx_t_23) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_t_23); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 970, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_22); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 970, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
          PyObject* sequence = __pyx_t_5;
          #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, 970, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_22 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_23 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_22 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_23 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_22);
          __Pyx_INCREF(__pyx_t_23);
          #else
          __pyx_t_22 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 970, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_23 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 970, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_23);
          #endif
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_21 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 970, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_21)->tp_iternext;
          index = 0; __pyx_t_22 = __pyx_t_6(__pyx_t_21); if (unlikely(!__pyx_t_22)) goto __pyx_L71_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_22);
          index = 1; __pyx_t_23 = __pyx_t_6(__pyx_t_21); if (unlikely(!__pyx_t_23)) goto __pyx_L71_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_23);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_21), 2) < 0) __PYX_ERR(0, 970, __pyx_L1_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          goto __pyx_L72_unpacking_done;
          __pyx_L71_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __pyx_t_6 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 970, __pyx_L1_error)
          __pyx_L72_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_mw, __pyx_t_22);
        __pyx_t_22 = 0;
        __Pyx_XDECREF_SET(__pyx_v_mh, __pyx_t_23);
        __pyx_t_23 = 0;

        /* "renpy/display/render.pyx":972
 *                     mw, mh = mask.get_size()
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)             # <<<<<<<<<<<<<<
 *                     my, mcy, mh = compute_subline(my, mh, y, h)
 * 
 */
        __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s_compute_subline); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 972, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_23);
        __pyx_t_22 = NULL;
        __pyx_t_12 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) {
          __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_23);
          if (likely(__pyx_t_22)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23);
            __Pyx_INCREF(__pyx_t_22);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_23, function);
            __pyx_t_12 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_23)) {
          PyObject *__pyx_temp[5] = {__pyx_t_22, __pyx_v_mx, __pyx_v_mw, __pyx_v_x, __pyx_v_w};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_23)) {
          PyObject *__pyx_temp[5] = {__pyx_t_22, __pyx_v_mx, __pyx_v_mw, __pyx_v_x, __pyx_v_w};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_23, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_21 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          if (__pyx_t_22) {
            __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_22); __pyx_t_22 = NULL;
          }
          __Pyx_INCREF(__pyx_v_mx);
          __Pyx_GIVEREF(__pyx_v_mx);
          PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_12, __pyx_v_mx);
          __Pyx_INCREF(__pyx_v_mw);
          __Pyx_GIVEREF(__pyx_v_mw);
          PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_12, __pyx_v_mw);
          __Pyx_INCREF(__pyx_v_x);
          __Pyx_GIVEREF(__pyx_v_x);
          PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_12, __pyx_v_x);
          __Pyx_INCREF(__pyx_v_w);
          __Pyx_GIVEREF(__pyx_v_w);
          PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_12, __pyx_v_w);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_23, __pyx_t_21, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        }
        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
          PyObject* sequence = __pyx_t_5;
          #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, 972, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_23 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_22 = PyTuple_GET_ITEM(sequence, 2); 
          } else {
            __pyx_t_23 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_21 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_22 = PyList_GET_ITEM(sequence, 2); 
          }
          __Pyx_INCREF(__pyx_t_23);
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_22);
          #else
          __pyx_t_23 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_23);
          __pyx_t_21 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_22 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_22);
          #endif
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 972, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
          index = 0; __pyx_t_23 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_23)) goto __pyx_L73_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_23);
          index = 1; __pyx_t_21 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_21)) goto __pyx_L73_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_21);
          index = 2; __pyx_t_22 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_22)) goto __pyx_L73_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_22);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 972, __pyx_L1_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L74_unpacking_done;
          __pyx_L73_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, 972, __pyx_L1_error)
          __pyx_L74_unpacking_done:;
        }
        __Pyx_DECREF_SET(__pyx_v_mx, __pyx_t_23);
        __pyx_t_23 = 0;
        __Pyx_XDECREF_SET(__pyx_v_mcx, __pyx_t_21);
        __pyx_t_21 = 0;
        __Pyx_DECREF_SET(__pyx_v_mw, __pyx_t_22);
        __pyx_t_22 = 0;

        /* "renpy/display/render.pyx":973
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)
 *                     my, mcy, mh = compute_subline(my, mh, y, h)             # <<<<<<<<<<<<<<
 * 
 *                     if mw <= 0 or mh <= 0:
 */
        __pyx_t_22 = __Pyx_GetModuleGlobalName(__pyx_n_s_compute_subline); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 973, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_22);
        __pyx_t_21 = NULL;
        __pyx_t_12 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) {
          __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_22);
          if (likely(__pyx_t_21)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22);
            __Pyx_INCREF(__pyx_t_21);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_22, function);
            __pyx_t_12 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_22)) {
          PyObject *__pyx_temp[5] = {__pyx_t_21, __pyx_v_my, __pyx_v_mh, __pyx_v_y, __pyx_v_h};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_22)) {
          PyObject *__pyx_temp[5] = {__pyx_t_21, __pyx_v_my, __pyx_v_mh, __pyx_v_y, __pyx_v_h};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_22, __pyx_temp+1-__pyx_t_12, 4+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_23 = PyTuple_New(4+__pyx_t_12); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_23);
          if (__pyx_t_21) {
            __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_21); __pyx_t_21 = NULL;
          }
          __Pyx_INCREF(__pyx_v_my);
          __Pyx_GIVEREF(__pyx_v_my);
          PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_12, __pyx_v_my);
          __Pyx_INCREF(__pyx_v_mh);
          __Pyx_GIVEREF(__pyx_v_mh);
          PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_12, __pyx_v_mh);
          __Pyx_INCREF(__pyx_v_y);
          __Pyx_GIVEREF(__pyx_v_y);
          PyTuple_SET_ITEM(__pyx_t_23, 2+__pyx_t_12, __pyx_v_y);
          __Pyx_INCREF(__pyx_v_h);
          __Pyx_GIVEREF(__pyx_v_h);
          PyTuple_SET_ITEM(__pyx_t_23, 3+__pyx_t_12, __pyx_v_h);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_22, __pyx_t_23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
        }
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
          PyObject* sequence = __pyx_t_5;
          #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, 973, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_22 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_23 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_21 = PyTuple_GET_ITEM(sequence, 2); 
          } else {
            __pyx_t_22 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_23 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_21 = PyList_GET_ITEM(sequence, 2); 
          }
          __Pyx_INCREF(__pyx_t_22);
          __Pyx_INCREF(__pyx_t_23);
          __Pyx_INCREF(__pyx_t_21);
          #else
          __pyx_t_22 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_22);
          __pyx_t_23 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_23);
          __pyx_t_21 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          #endif
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 973, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
          index = 0; __pyx_t_22 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_22)) goto __pyx_L75_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_22);
          index = 1; __pyx_t_23 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_23)) goto __pyx_L75_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_23);
          index = 2; __pyx_t_21 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_21)) goto __pyx_L75_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_21);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 973, __pyx_L1_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L76_unpacking_done;
          __pyx_L75_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, 973, __pyx_L1_error)
          __pyx_L76_unpacking_done:;
        }
        __Pyx_DECREF_SET(__pyx_v_my, __pyx_t_22);
        __pyx_t_22 = 0;
        __Pyx_XDECREF_SET(__pyx_v_mcy, __pyx_t_23);
        __pyx_t_23 = 0;
        __Pyx_DECREF_SET(__pyx_v_mh, __pyx_t_21);
        __pyx_t_21 = 0;

        /* "renpy/display/render.pyx":975
 *                     my, mcy, mh = compute_subline(my, mh, y, h)
 * 
 *                     if mw <= 0 or mh <= 0:             # <<<<<<<<<<<<<<
 *                         mx = None
 *                         my = None
 */
        __pyx_t_5 = PyObject_RichCompare(__pyx_v_mw, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 975, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 975, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (!__pyx_t_7) {
        } else {
          __pyx_t_9 = __pyx_t_7;
          goto __pyx_L78_bool_binop_done;
        }
        __pyx_t_5 = PyObject_RichCompare(__pyx_v_mh, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 975, __pyx_L1_error)
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 975, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_9 = __pyx_t_7;
        __pyx_L78_bool_binop_done:;
        if (__pyx_t_9) {

          /* "renpy/display/render.pyx":976
 * 
 *                     if mw <= 0 or mh <= 0:
 *                         mx = None             # <<<<<<<<<<<<<<
 *                         my = None
 *                         mask = None
 */
          __Pyx_INCREF(Py_None);
          __Pyx_DECREF_SET(__pyx_v_mx, Py_None);

          /* "renpy/display/render.pyx":977
 *                     if mw <= 0 or mh <= 0:
 *                         mx = None
 *                         my = None             # <<<<<<<<<<<<<<
 *                         mask = None
 *                     else:
 */
          __Pyx_INCREF(Py_None);
          __Pyx_DECREF_SET(__pyx_v_my, Py_None);

          /* "renpy/display/render.pyx":978
 *                         mx = None
 *                         my = None
 *                         mask = None             # <<<<<<<<<<<<<<
 *                     else:
 *                         mask = mask.subsurface((mcx, mcy, mw, mh))
 */
          __Pyx_INCREF(Py_None);
          __Pyx_DECREF_SET(__pyx_v_mask, Py_None);

          /* "renpy/display/render.pyx":975
 *                     my, mcy, mh = compute_subline(my, mh, y, h)
 * 
 *                     if mw <= 0 or mh <= 0:             # <<<<<<<<<<<<<<
 *                         mx = None
 *                         my = None
 */
          goto __pyx_L77;
        }

        /* "renpy/display/render.pyx":980
 *                         mask = None
 *                     else:
 *                         mask = mask.subsurface((mcx, mcy, mw, mh))             # <<<<<<<<<<<<<<
 * 
 *                 rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 */
        /*else*/ {
          __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 980, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_23 = PyTuple_New(4); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 980, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_23);
          __Pyx_INCREF(__pyx_v_mcx);
          __Pyx_GIVEREF(__pyx_v_mcx);
          PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_v_mcx);
          __Pyx_INCREF(__pyx_v_mcy);
          __Pyx_GIVEREF(__pyx_v_mcy);
          PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_v_mcy);
          __Pyx_INCREF(__pyx_v_mw);
          __Pyx_GIVEREF(__pyx_v_mw);
          PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_v_mw);
          __Pyx_INCREF(__pyx_v_mh);
          __Pyx_GIVEREF(__pyx_v_mh);
          PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_v_mh);
          __pyx_t_22 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_21))) {
            __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_21);
            if (likely(__pyx_t_22)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
              __Pyx_INCREF(__pyx_t_22);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_21, function);
            }
          }
          if (!__pyx_t_22) {
            __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_23); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 980, __pyx_L1_error)
            __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
            __Pyx_GOTREF(__pyx_t_5);
          } else {
            #if CYTHON_FAST_PYCALL
            if (PyFunction_Check(__pyx_t_21)) {
              PyObject *__pyx_temp[2] = {__pyx_t_22, __pyx_t_23};
              __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 980, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
            } else
            #endif
            #if CYTHON_FAST_PYCCALL
            if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
              PyObject *__pyx_temp[2] = {__pyx_t_22, __pyx_t_23};
              __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 980, __pyx_L1_error)
              __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0;
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
            } else
            #endif
            {
              __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 980, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_GIVEREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_22); __pyx_t_22 = NULL;
              __Pyx_GIVEREF(__pyx_t_23);
              PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_23);
              __pyx_t_23 = 0;
              __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 980, __pyx_L1_error)
              __Pyx_GOTREF(__pyx_t_5);
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            }
          }
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          __Pyx_DECREF_SET(__pyx_v_mask, __pyx_t_5);
          __pyx_t_5 = 0;
        }
        __pyx_L77:;

        /* "renpy/display/render.pyx":968
 *                     continue
 * 
 *                 if mx is not None:             # <<<<<<<<<<<<<<
 * 
 *                     mw, mh = mask.get_size()
 */
      }

      /* "renpy/display/render.pyx":982
 *                         mask = mask.subsurface((mcx, mcy, mw, mh))
 * 
 *                 rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)             # <<<<<<<<<<<<<<
 * 
 *         rv.depends_on(self)
 */
      __pyx_t_21 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_add_focus); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 982, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      __pyx_t_3 = NULL;
      __pyx_t_12 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_21))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_21);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_21, function);
          __pyx_t_12 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_21)) {
        PyObject *__pyx_temp[10] = {__pyx_t_3, __pyx_v_d, __pyx_v_arg, __pyx_v_xo, __pyx_v_yo, __pyx_v_fw, __pyx_v_fh, __pyx_v_mx, __pyx_v_my, __pyx_v_mask};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_12, 9+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 982, __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_21)) {
        PyObject *__pyx_temp[10] = {__pyx_t_3, __pyx_v_d, __pyx_v_arg, __pyx_v_xo, __pyx_v_yo, __pyx_v_fw, __pyx_v_fh, __pyx_v_mx, __pyx_v_my, __pyx_v_mask};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_12, 9+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 982, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_23 = PyTuple_New(9+__pyx_t_12); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 982, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_23);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_23, 0+__pyx_t_12, __pyx_v_d);
        __Pyx_INCREF(__pyx_v_arg);
        __Pyx_GIVEREF(__pyx_v_arg);
        PyTuple_SET_ITEM(__pyx_t_23, 1+__pyx_t_12, __pyx_v_arg);
        __Pyx_INCREF(__pyx_v_xo);
        __Pyx_GIVEREF(__pyx_v_xo);
        PyTuple_SET_ITEM(__pyx_t_23, 2+__pyx_t_12, __pyx_v_xo);
        __Pyx_INCREF(__pyx_v_yo);
        __Pyx_GIVEREF(__pyx_v_yo);
        PyTuple_SET_ITEM(__pyx_t_23, 3+__pyx_t_12, __pyx_v_yo);
        __Pyx_INCREF(__pyx_v_fw);
        __Pyx_GIVEREF(__pyx_v_fw);
        PyTuple_SET_ITEM(__pyx_t_23, 4+__pyx_t_12, __pyx_v_fw);
        __Pyx_INCREF(__pyx_v_fh);
        __Pyx_GIVEREF(__pyx_v_fh);
        PyTuple_SET_ITEM(__pyx_t_23, 5+__pyx_t_12, __pyx_v_fh);
        __Pyx_INCREF(__pyx_v_mx);
        __Pyx_GIVEREF(__pyx_v_mx);
        PyTuple_SET_ITEM(__pyx_t_23, 6+__pyx_t_12, __pyx_v_mx);
        __Pyx_INCREF(__pyx_v_my);
        __Pyx_GIVEREF(__pyx_v_my);
        PyTuple_SET_ITEM(__pyx_t_23, 7+__pyx_t_12, __pyx_v_my);
        __Pyx_INCREF(__pyx_v_mask);
        __Pyx_GIVEREF(__pyx_v_mask);
        PyTuple_SET_ITEM(__pyx_t_23, 8+__pyx_t_12, __pyx_v_mask);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 982, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
      }
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":956
 *         if focus and self.focuses:
 * 
 *             for (d, arg, xo, yo, fw, fh, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
      __pyx_L58_continue:;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":954
 *             rv.blit(newchild, offset, focus=cfocus, main=cmain)
 * 
 *         if focus and self.focuses:             # <<<<<<<<<<<<<<
 * 
 *             for (d, arg, xo, yo, fw, fh, mx, my, mask) in self.focuses:
 */
  }

  /* "renpy/display/render.pyx":984
 *                 rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 * 
 *         rv.depends_on(self)             # <<<<<<<<<<<<<<
 *         rv.alpha = self.alpha
 *         rv.operation = self.operation
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_depends_on); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_21 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_21)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_21);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_21) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 984, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_21, ((PyObject *)__pyx_v_self)};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 984, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[2] = {__pyx_t_21, ((PyObject *)__pyx_v_self)};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 984, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_23 = PyTuple_New(1+1); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_23);
      __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_21); __pyx_t_21 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_23, 0+1, ((PyObject *)__pyx_v_self));
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_23, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 984, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":985
 * 
 *         rv.depends_on(self)
 *         rv.alpha = self.alpha             # <<<<<<<<<<<<<<
 *         rv.operation = self.operation
 *         rv.operation_alpha = self.operation_alpha
 */
  __pyx_t_10 = __pyx_v_self->alpha;
  __pyx_v_rv->alpha = __pyx_t_10;

  /* "renpy/display/render.pyx":986
 *         rv.depends_on(self)
 *         rv.alpha = self.alpha
 *         rv.operation = self.operation             # <<<<<<<<<<<<<<
 *         rv.operation_alpha = self.operation_alpha
 *         rv.operation_complete = self.operation_complete
 */
  __pyx_t_12 = __pyx_v_self->operation;
  __pyx_v_rv->operation = __pyx_t_12;

  /* "renpy/display/render.pyx":987
 *         rv.alpha = self.alpha
 *         rv.operation = self.operation
 *         rv.operation_alpha = self.operation_alpha             # <<<<<<<<<<<<<<
 *         rv.operation_complete = self.operation_complete
 *         rv.nearest = self.nearest
 */
  __pyx_t_9 = __pyx_v_self->operation_alpha;
  __pyx_v_rv->operation_alpha = __pyx_t_9;

  /* "renpy/display/render.pyx":988
 *         rv.operation = self.operation
 *         rv.operation_alpha = self.operation_alpha
 *         rv.operation_complete = self.operation_complete             # <<<<<<<<<<<<<<
 *         rv.nearest = self.nearest
 * 
 */
  __pyx_t_10 = __pyx_v_self->operation_complete;
  __pyx_v_rv->operation_complete = __pyx_t_10;

  /* "renpy/display/render.pyx":989
 *         rv.operation_alpha = self.operation_alpha
 *         rv.operation_complete = self.operation_complete
 *         rv.nearest = self.nearest             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_4 = __pyx_v_self->nearest;
  __Pyx_INCREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_rv->nearest);
  __Pyx_DECREF(__pyx_v_rv->nearest);
  __pyx_v_rv->nearest = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":991
 *         rv.nearest = self.nearest
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_rv));
  __pyx_r = ((PyObject *)__pyx_v_rv);
  goto __pyx_L0;

  /* "renpy/display/render.pyx":830
 *     pygame_surface = render_to_texture
 * 
 *     def subsurface(self, rect, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a subsurface of this render. If `focus` is true, then
 */

  /* 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_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __Pyx_XDECREF(__pyx_t_23);
  __Pyx_XDECREF(__pyx_t_24);
  __Pyx_AddTraceback("renpy.display.render.Render.subsurface", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF((PyObject *)__pyx_v_rv);
  __Pyx_XDECREF((PyObject *)__pyx_v_reverse);
  __Pyx_XDECREF(__pyx_v_tx);
  __Pyx_XDECREF(__pyx_v_ty);
  __Pyx_XDECREF(__pyx_v_tw);
  __Pyx_XDECREF(__pyx_v_th);
  __Pyx_XDECREF(__pyx_v_rw);
  __Pyx_XDECREF(__pyx_v_rh);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_cx);
  __Pyx_XDECREF(__pyx_v_cy);
  __Pyx_XDECREF(__pyx_v_cfocus);
  __Pyx_XDECREF(__pyx_v_cmain);
  __Pyx_XDECREF(__pyx_v_childw);
  __Pyx_XDECREF(__pyx_v_childh);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_cw);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_ch);
  __Pyx_XDECREF(__pyx_v_offset);
  __Pyx_XDECREF(__pyx_v_crop);
  __Pyx_XDECREF(__pyx_v_cropw);
  __Pyx_XDECREF(__pyx_v_croph);
  __Pyx_XDECREF(__pyx_v_newchild);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_fw);
  __Pyx_XDECREF(__pyx_v_fh);
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v_mw);
  __Pyx_XDECREF(__pyx_v_mh);
  __Pyx_XDECREF(__pyx_v_mcx);
  __Pyx_XDECREF(__pyx_v_mcy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":994
 * 
 * 
 *     def depends_on(self, source, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Used to indicate that this render depends on another
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_21depends_on(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_20depends_on[] = "\n        Used to indicate that this render depends on another\n        render. Useful, for example, if we use pygame_surface to make\n        a surface, and then blit that surface into another render.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_21depends_on(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("depends_on (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_source,&__pyx_n_s_focus,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_source)) != 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_focus);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "depends_on") < 0)) __PYX_ERR(0, 994, __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_source = values[0];
    __pyx_v_focus = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("depends_on", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 994, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.depends_on", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_20depends_on(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_source, __pyx_v_focus);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_20depends_on(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_source, PyObject *__pyx_v_focus) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("depends_on", 0);

  /* "renpy/display/render.pyx":1001
 *         """
 * 
 *         if source is self:             # <<<<<<<<<<<<<<
 *             raise Exception("Render depends on itself.")
 * 
 */
  __pyx_t_1 = (__pyx_v_source == ((PyObject *)__pyx_v_self));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1002
 * 
 *         if source is self:
 *             raise Exception("Render depends on itself.")             # <<<<<<<<<<<<<<
 * 
 *         self.depends_on_list.append(source)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1002, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 1002, __pyx_L1_error)

    /* "renpy/display/render.pyx":1001
 *         """
 * 
 *         if source is self:             # <<<<<<<<<<<<<<
 *             raise Exception("Render depends on itself.")
 * 
 */
  }

  /* "renpy/display/render.pyx":1004
 *             raise Exception("Render depends on itself.")
 * 
 *         self.depends_on_list.append(source)             # <<<<<<<<<<<<<<
 *         source.parents.add(self)
 * 
 */
  if (unlikely(__pyx_v_self->depends_on_list == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
    __PYX_ERR(0, 1004, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->depends_on_list, __pyx_v_source); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1004, __pyx_L1_error)

  /* "renpy/display/render.pyx":1005
 * 
 *         self.depends_on_list.append(source)
 *         source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         if focus:
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_parents); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1005, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_add); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1005, __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_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);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self)};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __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_6)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self)};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1005, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(((PyObject *)__pyx_v_self));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_self));
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1007
 *         source.parents.add(self)
 * 
 *         if focus:             # <<<<<<<<<<<<<<
 *             if self.pass_focuses is None:
 *                 self.pass_focuses = [ source ]
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1007, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1008
 * 
 *         if focus:
 *             if self.pass_focuses is None:             # <<<<<<<<<<<<<<
 *                 self.pass_focuses = [ source ]
 *             else:
 */
    __pyx_t_2 = (__pyx_v_self->pass_focuses == ((PyObject*)Py_None));
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":1009
 *         if focus:
 *             if self.pass_focuses is None:
 *                 self.pass_focuses = [ source ]             # <<<<<<<<<<<<<<
 *             else:
 *                 self.pass_focuses.append(source)
 */
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1009, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_source);
      __Pyx_GIVEREF(__pyx_v_source);
      PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
      __Pyx_GIVEREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_v_self->pass_focuses);
      __Pyx_DECREF(__pyx_v_self->pass_focuses);
      __pyx_v_self->pass_focuses = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;

      /* "renpy/display/render.pyx":1008
 * 
 *         if focus:
 *             if self.pass_focuses is None:             # <<<<<<<<<<<<<<
 *                 self.pass_focuses = [ source ]
 *             else:
 */
      goto __pyx_L5;
    }

    /* "renpy/display/render.pyx":1011
 *                 self.pass_focuses = [ source ]
 *             else:
 *                 self.pass_focuses.append(source)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    /*else*/ {
      if (unlikely(__pyx_v_self->pass_focuses == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
        __PYX_ERR(0, 1011, __pyx_L1_error)
      }
      __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->pass_focuses, __pyx_v_source); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 1011, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "renpy/display/render.pyx":1007
 *         source.parents.add(self)
 * 
 *         if focus:             # <<<<<<<<<<<<<<
 *             if self.pass_focuses is None:
 *                 self.pass_focuses = [ source ]
 */
  }

  /* "renpy/display/render.pyx":994
 * 
 * 
 *     def depends_on(self, source, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Used to indicate that this render depends on another
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Render.depends_on", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1014
 * 
 * 
 *     def kill_cache(self):             # <<<<<<<<<<<<<<
 *         """
 *         Removes this render and its transitive parents from the cache.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_23kill_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_22kill_cache[] = "\n        Removes this render and its transitive parents from the cache.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_23kill_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kill_cache (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_22kill_cache(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_22kill_cache(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_ro = NULL;
  PyObject *__pyx_v_id_ro = NULL;
  PyObject *__pyx_v_cache = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  Py_ssize_t __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  __Pyx_RefNannySetupContext("kill_cache", 0);

  /* "renpy/display/render.pyx":1019
 *         """
 * 
 *         if self.cache_killed:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = (__pyx_v_self->cache_killed != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1020
 * 
 *         if self.cache_killed:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.cache_killed = True
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1019
 *         """
 * 
 *         if self.cache_killed:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "renpy/display/render.pyx":1022
 *             return
 * 
 *         self.cache_killed = True             # <<<<<<<<<<<<<<
 * 
 *         for i in self.parents:
 */
  __pyx_v_self->cache_killed = 1;

  /* "renpy/display/render.pyx":1024
 *         self.cache_killed = True
 * 
 *         for i in self.parents:             # <<<<<<<<<<<<<<
 *             i.kill_cache()
 * 
 */
  __pyx_t_2 = PyObject_GetIter(__pyx_v_self->parents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1024, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1024, __pyx_L1_error)
  for (;;) {
    {
      __pyx_t_4 = __pyx_t_3(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1024, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1025
 * 
 *         for i in self.parents:
 *             i.kill_cache()             # <<<<<<<<<<<<<<
 * 
 *         self.parents.clear()
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_kill_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1025, __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1025, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1025, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1024
 *         self.cache_killed = True
 * 
 *         for i in self.parents:             # <<<<<<<<<<<<<<
 *             i.kill_cache()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1027
 *             i.kill_cache()
 * 
 *         self.parents.clear()             # <<<<<<<<<<<<<<
 * 
 *         for i in self.depends_on_list:
 */
  if (unlikely(__pyx_v_self->parents == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "clear");
    __PYX_ERR(0, 1027, __pyx_L1_error)
  }
  __pyx_t_7 = PySet_Clear(__pyx_v_self->parents); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1027, __pyx_L1_error)

  /* "renpy/display/render.pyx":1029
 *         self.parents.clear()
 * 
 *         for i in self.depends_on_list:             # <<<<<<<<<<<<<<
 *             if not i.cache_killed:
 *                 i.parents.discard(self)
 */
  if (unlikely(__pyx_v_self->depends_on_list == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1029, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_self->depends_on_list; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1029, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1029, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1030
 * 
 *         for i in self.depends_on_list:
 *             if not i.cache_killed:             # <<<<<<<<<<<<<<
 *                 i.parents.discard(self)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_cache_killed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1030, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = ((!__pyx_t_1) != 0);
    if (__pyx_t_9) {

      /* "renpy/display/render.pyx":1031
 *         for i in self.depends_on_list:
 *             if not i.cache_killed:
 *                 i.parents.discard(self)             # <<<<<<<<<<<<<<
 * 
 *         for ro in self.render_of:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_parents); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1031, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_discard); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1031, __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_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);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self)};
          __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
          PyObject *__pyx_temp[2] = {__pyx_t_5, ((PyObject *)__pyx_v_self)};
          __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else
        #endif
        {
          __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1031, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL;
          __Pyx_INCREF(((PyObject *)__pyx_v_self));
          __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
          PyTuple_SET_ITEM(__pyx_t_10, 0+1, ((PyObject *)__pyx_v_self));
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1031, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        }
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":1030
 * 
 *         for i in self.depends_on_list:
 *             if not i.cache_killed:             # <<<<<<<<<<<<<<
 *                 i.parents.discard(self)
 * 
 */
    }

    /* "renpy/display/render.pyx":1029
 *         self.parents.clear()
 * 
 *         for i in self.depends_on_list:             # <<<<<<<<<<<<<<
 *             if not i.cache_killed:
 *                 i.parents.discard(self)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1033
 *                 i.parents.discard(self)
 * 
 *         for ro in self.render_of:             # <<<<<<<<<<<<<<
 *             id_ro = id(ro)
 * 
 */
  if (likely(PyList_CheckExact(__pyx_v_self->render_of)) || PyTuple_CheckExact(__pyx_v_self->render_of)) {
    __pyx_t_2 = __pyx_v_self->render_of; __Pyx_INCREF(__pyx_t_2); __pyx_t_8 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->render_of); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1033, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1033, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1033, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1033, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1033, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1033, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 1033, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_ro, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1034
 * 
 *         for ro in self.render_of:
 *             id_ro = id(ro)             # <<<<<<<<<<<<<<
 * 
 *             cache = render_cache[id_ro]
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_ro);
    __Pyx_GIVEREF(__pyx_v_ro);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_ro);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_id, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1034, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_id_ro, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "renpy/display/render.pyx":1036
 *             id_ro = id(ro)
 * 
 *             cache = render_cache[id_ro]             # <<<<<<<<<<<<<<
 *             for k, v in cache.items():
 *                 if v is self:
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_4 = PyObject_GetItem(__pyx_t_6, __pyx_v_id_ro); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1036, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cache, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1037
 * 
 *             cache = render_cache[id_ro]
 *             for k, v in cache.items():             # <<<<<<<<<<<<<<
 *                 if v is self:
 *                     del cache[k]
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_cache, __pyx_n_s_items); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_10) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1037, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1037, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_6 = __pyx_t_4; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0;
      __pyx_t_12 = NULL;
    } else {
      __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1037, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1037, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_12)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1037, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1037, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 1037, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_6, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1037, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_12(__pyx_t_6);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1037, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      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 != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1037, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_5);
        #else
        __pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1037, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1037, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1037, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
        index = 0; __pyx_t_10 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        index = 1; __pyx_t_5 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) __PYX_ERR(0, 1037, __pyx_L1_error)
        __pyx_t_14 = NULL;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L14_unpacking_done;
        __pyx_L13_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_14 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1037, __pyx_L1_error)
        __pyx_L14_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1038
 *             cache = render_cache[id_ro]
 *             for k, v in cache.items():
 *                 if v is self:             # <<<<<<<<<<<<<<
 *                     del cache[k]
 * 
 */
      __pyx_t_9 = (__pyx_v_v == ((PyObject *)__pyx_v_self));
      __pyx_t_1 = (__pyx_t_9 != 0);
      if (__pyx_t_1) {

        /* "renpy/display/render.pyx":1039
 *             for k, v in cache.items():
 *                 if v is self:
 *                     del cache[k]             # <<<<<<<<<<<<<<
 * 
 *             if not cache:
 */
        if (unlikely(PyObject_DelItem(__pyx_v_cache, __pyx_v_k) < 0)) __PYX_ERR(0, 1039, __pyx_L1_error)

        /* "renpy/display/render.pyx":1038
 *             cache = render_cache[id_ro]
 *             for k, v in cache.items():
 *                 if v is self:             # <<<<<<<<<<<<<<
 *                     del cache[k]
 * 
 */
      }

      /* "renpy/display/render.pyx":1037
 * 
 *             cache = render_cache[id_ro]
 *             for k, v in cache.items():             # <<<<<<<<<<<<<<
 *                 if v is self:
 *                     del cache[k]
 */
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "renpy/display/render.pyx":1041
 *                     del cache[k]
 * 
 *             if not cache:             # <<<<<<<<<<<<<<
 *                 del render_cache[id_ro]
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_cache); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1041, __pyx_L1_error)
    __pyx_t_9 = ((!__pyx_t_1) != 0);
    if (__pyx_t_9) {

      /* "renpy/display/render.pyx":1042
 * 
 *             if not cache:
 *                 del render_cache[id_ro]             # <<<<<<<<<<<<<<
 * 
 *     def kill(self):
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1042, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (unlikely(PyObject_DelItem(__pyx_t_6, __pyx_v_id_ro) < 0)) __PYX_ERR(0, 1042, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "renpy/display/render.pyx":1041
 *                     del cache[k]
 * 
 *             if not cache:             # <<<<<<<<<<<<<<
 *                 del render_cache[id_ro]
 * 
 */
    }

    /* "renpy/display/render.pyx":1033
 *                 i.parents.discard(self)
 * 
 *         for ro in self.render_of:             # <<<<<<<<<<<<<<
 *             id_ro = id(ro)
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1014
 * 
 * 
 *     def kill_cache(self):             # <<<<<<<<<<<<<<
 *         """
 *         Removes this render and its transitive parents from the cache.
 */

  /* 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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("renpy.display.render.Render.kill_cache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_ro);
  __Pyx_XDECREF(__pyx_v_id_ro);
  __Pyx_XDECREF(__pyx_v_cache);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1044
 *                 del render_cache[id_ro]
 * 
 *     def kill(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retained for compatibility, but does not need to be called.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_25kill(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_24kill[] = "\n        Retained for compatibility, but does not need to be called.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_25kill(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kill (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_24kill(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_24kill(CYTHON_UNUSED struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kill", 0);

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

/* "renpy/display/render.pyx":1049
 *         """
 * 
 *     def add_focus(self, d, arg=None, x=0, y=0, w=None, h=None, mx=None, my=None, mask=None):             # <<<<<<<<<<<<<<
 *         """
 *         This is called to indicate a region of the screen that can be
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_27add_focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_26add_focus[] = "\n        This is called to indicate a region of the screen that can be\n        focused.\n\n        `d` - the displayable that is being focused.\n        `arg` - an argument.\n\n        The rest of the parameters are a rectangle giving the portion of\n        this region corresponding to the focus. If they are all None, than\n        this focus is assumed to be the singular full-screen focus.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_27add_focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_arg = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_mx = 0;
  PyObject *__pyx_v_my = 0;
  PyObject *__pyx_v_mask = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_focus (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,&__pyx_n_s_arg,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_w,&__pyx_n_s_h,&__pyx_n_s_mx,&__pyx_n_s_my,&__pyx_n_s_mask,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)Py_None);
    values[2] = ((PyObject *)__pyx_int_0);
    values[3] = ((PyObject *)__pyx_int_0);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((PyObject *)Py_None);
    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_d)) != 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_arg);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mx);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_my);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mask);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_focus") < 0)) __PYX_ERR(0, 1049, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_d = values[0];
    __pyx_v_arg = values[1];
    __pyx_v_x = values[2];
    __pyx_v_y = values[3];
    __pyx_v_w = values[4];
    __pyx_v_h = values[5];
    __pyx_v_mx = values[6];
    __pyx_v_my = values[7];
    __pyx_v_mask = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_focus", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1049, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.add_focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_26add_focus(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_d, __pyx_v_arg, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h, __pyx_v_mx, __pyx_v_my, __pyx_v_mask);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_26add_focus(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_d, PyObject *__pyx_v_arg, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mask) {
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("add_focus", 0);

  /* "renpy/display/render.pyx":1062
 *         """
 * 
 *         if isinstance(mask, Render) and mask is not self:             # <<<<<<<<<<<<<<
 *             self.depends_on(mask)
 * 
 */
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_mask, __pyx_ptype_5renpy_7display_6render_Render); 
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_mask != ((PyObject *)__pyx_v_self));
  __pyx_t_2 = (__pyx_t_3 != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1063
 * 
 *         if isinstance(mask, Render) and mask is not self:
 *             self.depends_on(mask)             # <<<<<<<<<<<<<<
 * 
 *         t = (d, arg, x, y, w, h, mx, my, mask)
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_depends_on); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1063, __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_mask); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_mask};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_mask};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1063, __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_INCREF(__pyx_v_mask);
        __Pyx_GIVEREF(__pyx_v_mask);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_mask);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1063, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1062
 *         """
 * 
 *         if isinstance(mask, Render) and mask is not self:             # <<<<<<<<<<<<<<
 *             self.depends_on(mask)
 * 
 */
  }

  /* "renpy/display/render.pyx":1065
 *             self.depends_on(mask)
 * 
 *         t = (d, arg, x, y, w, h, mx, my, mask)             # <<<<<<<<<<<<<<
 * 
 *         if self.focuses is None:
 */
  __pyx_t_4 = PyTuple_New(9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1065, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_d);
  __Pyx_INCREF(__pyx_v_arg);
  __Pyx_GIVEREF(__pyx_v_arg);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_arg);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_h);
  __Pyx_INCREF(__pyx_v_mx);
  __Pyx_GIVEREF(__pyx_v_mx);
  PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_v_mx);
  __Pyx_INCREF(__pyx_v_my);
  __Pyx_GIVEREF(__pyx_v_my);
  PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_v_my);
  __Pyx_INCREF(__pyx_v_mask);
  __Pyx_GIVEREF(__pyx_v_mask);
  PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_v_mask);
  __pyx_v_t = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1067
 *         t = (d, arg, x, y, w, h, mx, my, mask)
 * 
 *         if self.focuses is None:             # <<<<<<<<<<<<<<
 *             self.focuses = [ t ]
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->focuses == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1068
 * 
 *         if self.focuses is None:
 *             self.focuses = [ t ]             # <<<<<<<<<<<<<<
 *         else:
 *             self.focuses.append(t)
 */
    __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1068, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_t);
    __Pyx_GIVEREF(__pyx_v_t);
    PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_t);
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->focuses);
    __Pyx_DECREF(__pyx_v_self->focuses);
    __pyx_v_self->focuses = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1067
 *         t = (d, arg, x, y, w, h, mx, my, mask)
 * 
 *         if self.focuses is None:             # <<<<<<<<<<<<<<
 *             self.focuses = [ t ]
 *         else:
 */
    goto __pyx_L6;
  }

  /* "renpy/display/render.pyx":1070
 *             self.focuses = [ t ]
 *         else:
 *             self.focuses.append(t)             # <<<<<<<<<<<<<<
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses): #@DuplicatedSignature
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->focuses == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "append");
      __PYX_ERR(0, 1070, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_self->focuses, __pyx_v_t); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1070, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":1049
 *         """
 * 
 *     def add_focus(self, d, arg=None, x=0, y=0, w=None, h=None, mx=None, my=None, mask=None):             # <<<<<<<<<<<<<<
 *         """
 *         This is called to indicate a region of the screen that can be
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Render.add_focus", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1072
 *             self.focuses.append(t)
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         This adds to focuses Focus objects corresponding to the focuses
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_29take_focuses(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_28take_focuses[] = "\n        This adds to focuses Focus objects corresponding to the focuses\n        added to this object and its children, transformed into screen\n        coordinates.\n\n        `cminx`, `cminy`, `cmaxx`, `cmaxy`\n            The clipping rectangle.\n\n        `reverse`\n            The transform from render to screen coordinates.\n\n        `x`, `y`\n            The offset of the upper-left corner of the render.\n\n        `screen`\n            The screen this is a render of, or None if this is not part of\n            a screen.\n\n        `focuses`\n            The list of focuses to add to.\n\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_29take_focuses(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cminx = 0;
  PyObject *__pyx_v_cminy = 0;
  PyObject *__pyx_v_cmaxx = 0;
  PyObject *__pyx_v_cmaxy = 0;
  PyObject *__pyx_v_reverse = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_screen = 0;
  PyObject *__pyx_v_focuses = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("take_focuses (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cminx,&__pyx_n_s_cminy,&__pyx_n_s_cmaxx,&__pyx_n_s_cmaxy,&__pyx_n_s_reverse,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_screen,&__pyx_n_s_focuses,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_cminx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cminy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 1); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cmaxx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 2); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cmaxy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 3); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reverse)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 4); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 5); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 6); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_screen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 7); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_focuses)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, 8); __PYX_ERR(0, 1072, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "take_focuses") < 0)) __PYX_ERR(0, 1072, __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_cminx = values[0];
    __pyx_v_cminy = values[1];
    __pyx_v_cmaxx = values[2];
    __pyx_v_cmaxy = values[3];
    __pyx_v_reverse = values[4];
    __pyx_v_x = values[5];
    __pyx_v_y = values[6];
    __pyx_v_screen = values[7];
    __pyx_v_focuses = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1072, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.take_focuses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_28take_focuses(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_reverse, __pyx_v_x, __pyx_v_y, __pyx_v_screen, __pyx_v_focuses);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_28take_focuses(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_cminx, PyObject *__pyx_v_cminy, PyObject *__pyx_v_cmaxx, PyObject *__pyx_v_cmaxy, PyObject *__pyx_v_reverse, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_screen, PyObject *__pyx_v_focuses) {
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_h = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_mx = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_my = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v_x1 = NULL;
  PyObject *__pyx_v_y1 = NULL;
  PyObject *__pyx_v_x2 = NULL;
  PyObject *__pyx_v_y2 = NULL;
  PyObject *__pyx_v_minx = NULL;
  PyObject *__pyx_v_miny = NULL;
  PyObject *__pyx_v_maxx = NULL;
  PyObject *__pyx_v_maxy = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __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;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_t_17;
  int __pyx_t_18;
  int __pyx_t_19;
  __Pyx_RefNannySetupContext("take_focuses", 0);
  __Pyx_INCREF(__pyx_v_cminx);
  __Pyx_INCREF(__pyx_v_cminy);
  __Pyx_INCREF(__pyx_v_cmaxx);
  __Pyx_INCREF(__pyx_v_cmaxy);
  __Pyx_INCREF(__pyx_v_reverse);
  __Pyx_INCREF(__pyx_v_screen);

  /* "renpy/display/render.pyx":1096
 *         """
 * 
 *         if self.focus_screen is not None:             # <<<<<<<<<<<<<<
 *             screen = self.focus_screen
 * 
 */
  __pyx_t_1 = (__pyx_v_self->focus_screen != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1097
 * 
 *         if self.focus_screen is not None:
 *             screen = self.focus_screen             # <<<<<<<<<<<<<<
 * 
 *         if self.modal:
 */
    __pyx_t_3 = __pyx_v_self->focus_screen;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_screen, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1096
 *         """
 * 
 *         if self.focus_screen is not None:             # <<<<<<<<<<<<<<
 *             screen = self.focus_screen
 * 
 */
  }

  /* "renpy/display/render.pyx":1099
 *             screen = self.focus_screen
 * 
 *         if self.modal:             # <<<<<<<<<<<<<<
 *             focuses[:] = [ ]
 * 
 */
  __pyx_t_2 = (__pyx_v_self->modal != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1100
 * 
 *         if self.modal:
 *             focuses[:] = [ ]             # <<<<<<<<<<<<<<
 * 
 *         if self.reverse:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1100, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetSlice(__pyx_v_focuses, __pyx_t_3, 0, 0, NULL, NULL, &__pyx_slice__8, 0, 0, 1) < 0) __PYX_ERR(0, 1100, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1099
 *             screen = self.focus_screen
 * 
 *         if self.modal:             # <<<<<<<<<<<<<<
 *             focuses[:] = [ ]
 * 
 */
  }

  /* "renpy/display/render.pyx":1102
 *             focuses[:] = [ ]
 * 
 *         if self.reverse:             # <<<<<<<<<<<<<<
 *             reverse = reverse * self.reverse
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->reverse)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1102, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1103
 * 
 *         if self.reverse:
 *             reverse = reverse * self.reverse             # <<<<<<<<<<<<<<
 * 
 *         if self.focuses:
 */
    __pyx_t_3 = PyNumber_Multiply(__pyx_v_reverse, ((PyObject *)__pyx_v_self->reverse)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1103, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_reverse, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1102
 *             focuses[:] = [ ]
 * 
 *         if self.reverse:             # <<<<<<<<<<<<<<
 *             reverse = reverse * self.reverse
 * 
 */
  }

  /* "renpy/display/render.pyx":1105
 *             reverse = reverse * self.reverse
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 */
  __pyx_t_2 = (__pyx_v_self->focuses != Py_None) && (PyList_GET_SIZE(__pyx_v_self->focuses) != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1107
 *         if self.focuses:
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
    if (unlikely(__pyx_v_self->focuses == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1107, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_v_self->focuses; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1107, __pyx_L1_error)
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1107, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #if !CYTHON_COMPILING_IN_PYPY
        Py_ssize_t size = Py_SIZE(sequence);
        #else
        Py_ssize_t size = PySequence_Size(sequence);
        #endif
        if (unlikely(size != 9)) {
          if (size > 9) __Pyx_RaiseTooManyValuesError(9);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1107, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 6); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 7); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 8); 
        } else {
          __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_8 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 3); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 4); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 5); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 6); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 7); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 8); 
        }
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_14);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[9] = {&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14};
          for (i=0; i < 9; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1107, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[9] = {&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14};
        __pyx_t_15 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1107, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_15);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext;
        for (index=0; index < 9; index++) {
          PyObject* item = __pyx_t_16(__pyx_t_15); if (unlikely(!item)) goto __pyx_L9_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 9) < 0) __PYX_ERR(0, 1107, __pyx_L1_error)
        __pyx_t_16 = NULL;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        goto __pyx_L10_unpacking_done;
        __pyx_L9_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_16 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1107, __pyx_L1_error)
        __pyx_L10_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mx, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_XDECREF_SET(__pyx_v_my, __pyx_t_13);
      __pyx_t_13 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mask, __pyx_t_14);
      __pyx_t_14 = 0;

      /* "renpy/display/render.pyx":1109
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     focuses.append(renpy.display.focus.Focus(d, arg, None, None, None, None, screen))
 *                     continue
 */
      __pyx_t_2 = (__pyx_v_xo == Py_None);
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {

        /* "renpy/display/render.pyx":1110
 * 
 *                 if xo is None:
 *                     focuses.append(renpy.display.focus.Focus(d, arg, None, None, None, None, screen))             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_display); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_focus); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_Focus); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1110, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        __pyx_t_17 = 0;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_13, function);
            __pyx_t_17 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_13)) {
          PyObject *__pyx_temp[8] = {__pyx_t_14, __pyx_v_d, __pyx_v_arg, Py_None, Py_None, Py_None, Py_None, __pyx_v_screen};
          __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1110, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
          PyObject *__pyx_temp[8] = {__pyx_t_14, __pyx_v_d, __pyx_v_arg, Py_None, Py_None, Py_None, Py_None, __pyx_v_screen};
          __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1110, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_GOTREF(__pyx_t_5);
        } else
        #endif
        {
          __pyx_t_12 = PyTuple_New(7+__pyx_t_17); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1110, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_12);
          if (__pyx_t_14) {
            __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_14); __pyx_t_14 = NULL;
          }
          __Pyx_INCREF(__pyx_v_d);
          __Pyx_GIVEREF(__pyx_v_d);
          PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_17, __pyx_v_d);
          __Pyx_INCREF(__pyx_v_arg);
          __Pyx_GIVEREF(__pyx_v_arg);
          PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_17, __pyx_v_arg);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_17, Py_None);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_17, Py_None);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_17, Py_None);
          __Pyx_INCREF(Py_None);
          __Pyx_GIVEREF(Py_None);
          PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_17, Py_None);
          __Pyx_INCREF(__pyx_v_screen);
          __Pyx_GIVEREF(__pyx_v_screen);
          PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_17, __pyx_v_screen);
          __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1110, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        }
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_18 = __Pyx_PyObject_Append(__pyx_v_focuses, __pyx_t_5); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 1110, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "renpy/display/render.pyx":1111
 *                 if xo is None:
 *                     focuses.append(renpy.display.focus.Focus(d, arg, None, None, None, None, screen))
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 x1, y1 = reverse.transform(xo, yo)
 */
        goto __pyx_L7_continue;

        /* "renpy/display/render.pyx":1109
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     focuses.append(renpy.display.focus.Focus(d, arg, None, None, None, None, screen))
 *                     continue
 */
      }

      /* "renpy/display/render.pyx":1113
 *                     continue
 * 
 *                 x1, y1 = reverse.transform(xo, yo)             # <<<<<<<<<<<<<<
 *                 x2, y2 = reverse.transform(xo + w, yo + h)
 * 
 */
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_reverse, __pyx_n_s_transform); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1113, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = NULL;
      __pyx_t_17 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
          __pyx_t_17 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_13)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_xo, __pyx_v_yo};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_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_13)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_xo, __pyx_v_yo};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
        }
        __Pyx_INCREF(__pyx_v_xo);
        __Pyx_GIVEREF(__pyx_v_xo);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_17, __pyx_v_xo);
        __Pyx_INCREF(__pyx_v_yo);
        __Pyx_GIVEREF(__pyx_v_yo);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_17, __pyx_v_yo);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #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, 1113, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_13 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_14);
        #else
        __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1113, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_16 = Py_TYPE(__pyx_t_12)->tp_iternext;
        index = 0; __pyx_t_13 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_13)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        index = 1; __pyx_t_14 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_14)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_14);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1113, __pyx_L1_error)
        __pyx_t_16 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L13_unpacking_done;
        __pyx_L12_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, 1113, __pyx_L1_error)
        __pyx_L13_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_x1, __pyx_t_13);
      __pyx_t_13 = 0;
      __Pyx_XDECREF_SET(__pyx_v_y1, __pyx_t_14);
      __pyx_t_14 = 0;

      /* "renpy/display/render.pyx":1114
 * 
 *                 x1, y1 = reverse.transform(xo, yo)
 *                 x2, y2 = reverse.transform(xo + w, yo + h)             # <<<<<<<<<<<<<<
 * 
 *                 minx = min(x1, x2) + x
 */
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_reverse, __pyx_n_s_transform); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_13 = PyNumber_Add(__pyx_v_xo, __pyx_v_w); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PyNumber_Add(__pyx_v_yo, __pyx_v_h); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = NULL;
      __pyx_t_17 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
          __pyx_t_17 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_12};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_13, __pyx_t_12};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_17, __pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_17, __pyx_t_12);
        __pyx_t_13 = 0;
        __pyx_t_12 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
        PyObject* sequence = __pyx_t_5;
        #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, 1114, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_10);
        #else
        __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_12 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1114, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_16 = Py_TYPE(__pyx_t_12)->tp_iternext;
        index = 0; __pyx_t_14 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_14)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_14);
        index = 1; __pyx_t_10 = __pyx_t_16(__pyx_t_12); if (unlikely(!__pyx_t_10)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1114, __pyx_L1_error)
        __pyx_t_16 = 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_16 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1114, __pyx_L1_error)
        __pyx_L15_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_x2, __pyx_t_14);
      __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_y2, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "renpy/display/render.pyx":1116
 *                 x2, y2 = reverse.transform(xo + w, yo + h)
 * 
 *                 minx = min(x1, x2) + x             # <<<<<<<<<<<<<<
 *                 miny = min(y1, y2) + y
 *                 maxx = max(x1, x2) + x
 */
      __Pyx_INCREF(__pyx_v_x2);
      __pyx_t_5 = __pyx_v_x2;
      __Pyx_INCREF(__pyx_v_x1);
      __pyx_t_10 = __pyx_v_x1;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_14 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_14 = __pyx_t_10;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_14, __pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1116, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_minx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1117
 * 
 *                 minx = min(x1, x2) + x
 *                 miny = min(y1, y2) + y             # <<<<<<<<<<<<<<
 *                 maxx = max(x1, x2) + x
 *                 maxy = max(y1, y2) + y
 */
      __Pyx_INCREF(__pyx_v_y2);
      __pyx_t_5 = __pyx_v_y2;
      __Pyx_INCREF(__pyx_v_y1);
      __pyx_t_14 = __pyx_v_y1;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_10 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_14);
        __pyx_t_10 = __pyx_t_14;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_10, __pyx_v_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_miny, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1118
 *                 minx = min(x1, x2) + x
 *                 miny = min(y1, y2) + y
 *                 maxx = max(x1, x2) + x             # <<<<<<<<<<<<<<
 *                 maxy = max(y1, y2) + y
 * 
 */
      __Pyx_INCREF(__pyx_v_x2);
      __pyx_t_5 = __pyx_v_x2;
      __Pyx_INCREF(__pyx_v_x1);
      __pyx_t_10 = __pyx_v_x1;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_14 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_14 = __pyx_t_10;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_14, __pyx_v_x); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_maxx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1119
 *                 miny = min(y1, y2) + y
 *                 maxx = max(x1, x2) + x
 *                 maxy = max(y1, y2) + y             # <<<<<<<<<<<<<<
 * 
 *                 minx = max(minx, cminx)
 */
      __Pyx_INCREF(__pyx_v_y2);
      __pyx_t_5 = __pyx_v_y2;
      __Pyx_INCREF(__pyx_v_y1);
      __pyx_t_14 = __pyx_v_y1;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1119, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_10 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_14);
        __pyx_t_10 = __pyx_t_14;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Add(__pyx_t_10, __pyx_v_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1119, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_maxy, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1121
 *                 maxy = max(y1, y2) + y
 * 
 *                 minx = max(minx, cminx)             # <<<<<<<<<<<<<<
 *                 miny = max(miny, cminy)
 *                 maxx = min(maxx, cmaxx)
 */
      __Pyx_INCREF(__pyx_v_cminx);
      __pyx_t_5 = __pyx_v_cminx;
      __Pyx_INCREF(__pyx_v_minx);
      __pyx_t_10 = __pyx_v_minx;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1121, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1121, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_14 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_14 = __pyx_t_10;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_14;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF_SET(__pyx_v_minx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1122
 * 
 *                 minx = max(minx, cminx)
 *                 miny = max(miny, cminy)             # <<<<<<<<<<<<<<
 *                 maxx = min(maxx, cmaxx)
 *                 maxy = min(maxy, cmaxy)
 */
      __Pyx_INCREF(__pyx_v_cminy);
      __pyx_t_5 = __pyx_v_cminy;
      __Pyx_INCREF(__pyx_v_miny);
      __pyx_t_14 = __pyx_v_miny;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1122, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1122, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_10 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_14);
        __pyx_t_10 = __pyx_t_14;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_10;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_miny, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1123
 *                 minx = max(minx, cminx)
 *                 miny = max(miny, cminy)
 *                 maxx = min(maxx, cmaxx)             # <<<<<<<<<<<<<<
 *                 maxy = min(maxy, cmaxy)
 * 
 */
      __Pyx_INCREF(__pyx_v_cmaxx);
      __pyx_t_5 = __pyx_v_cmaxx;
      __Pyx_INCREF(__pyx_v_maxx);
      __pyx_t_10 = __pyx_v_maxx;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1123, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1123, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_14 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_14 = __pyx_t_10;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_14;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF_SET(__pyx_v_maxx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1124
 *                 miny = max(miny, cminy)
 *                 maxx = min(maxx, cmaxx)
 *                 maxy = min(maxy, cmaxy)             # <<<<<<<<<<<<<<
 * 
 *                 if minx >= maxx or miny >= maxy:
 */
      __Pyx_INCREF(__pyx_v_cmaxy);
      __pyx_t_5 = __pyx_v_cmaxy;
      __Pyx_INCREF(__pyx_v_maxy);
      __pyx_t_14 = __pyx_v_maxy;
      __pyx_t_12 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1124, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1124, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (__pyx_t_1) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_10 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_14);
        __pyx_t_10 = __pyx_t_14;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_10;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_maxy, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1126
 *                 maxy = min(maxy, cmaxy)
 * 
 *                 if minx >= maxx or miny >= maxy:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_minx, __pyx_v_maxx, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1126, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!__pyx_t_2) {
      } else {
        __pyx_t_1 = __pyx_t_2;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_miny, __pyx_v_maxy, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1126, __pyx_L1_error)
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1126, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __pyx_t_2;
      __pyx_L17_bool_binop_done:;
      if (__pyx_t_1) {

        /* "renpy/display/render.pyx":1127
 * 
 *                 if minx >= maxx or miny >= maxy:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))
 */
        goto __pyx_L7_continue;

        /* "renpy/display/render.pyx":1126
 *                 maxy = min(maxy, cmaxy)
 * 
 *                 if minx >= maxx or miny >= maxy:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      }

      /* "renpy/display/render.pyx":1129
 *                     continue
 * 
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))             # <<<<<<<<<<<<<<
 * 
 *         if self.xclipping:
 */
      __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_display); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_focus); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_Focus); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_10 = PyNumber_Subtract(__pyx_v_maxx, __pyx_v_minx); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = PyNumber_Subtract(__pyx_v_maxy, __pyx_v_miny); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = NULL;
      __pyx_t_17 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
          __pyx_t_17 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[8] = {__pyx_t_13, __pyx_v_d, __pyx_v_arg, __pyx_v_minx, __pyx_v_miny, __pyx_t_10, __pyx_t_12, __pyx_v_screen};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[8] = {__pyx_t_13, __pyx_v_d, __pyx_v_arg, __pyx_v_minx, __pyx_v_miny, __pyx_t_10, __pyx_t_12, __pyx_v_screen};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(7+__pyx_t_17); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1129, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_13) {
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
        }
        __Pyx_INCREF(__pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_17, __pyx_v_d);
        __Pyx_INCREF(__pyx_v_arg);
        __Pyx_GIVEREF(__pyx_v_arg);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_17, __pyx_v_arg);
        __Pyx_INCREF(__pyx_v_minx);
        __Pyx_GIVEREF(__pyx_v_minx);
        PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_17, __pyx_v_minx);
        __Pyx_INCREF(__pyx_v_miny);
        __Pyx_GIVEREF(__pyx_v_miny);
        PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_17, __pyx_v_miny);
        __Pyx_GIVEREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_17, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_17, __pyx_t_12);
        __Pyx_INCREF(__pyx_v_screen);
        __Pyx_GIVEREF(__pyx_v_screen);
        PyTuple_SET_ITEM(__pyx_t_11, 6+__pyx_t_17, __pyx_v_screen);
        __pyx_t_10 = 0;
        __pyx_t_12 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1129, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_18 = __Pyx_PyObject_Append(__pyx_v_focuses, __pyx_t_5); if (unlikely(__pyx_t_18 == ((int)-1))) __PYX_ERR(0, 1129, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1107
 *         if self.focuses:
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
      __pyx_L7_continue:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1105
 *             reverse = reverse * self.reverse
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 */
  }

  /* "renpy/display/render.pyx":1131
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))
 * 
 *         if self.xclipping:             # <<<<<<<<<<<<<<
 *             cminx = max(cminx, x)
 *             cmaxx = min(cmaxx, x + self.width)
 */
  __pyx_t_1 = (__pyx_v_self->xclipping != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1132
 * 
 *         if self.xclipping:
 *             cminx = max(cminx, x)             # <<<<<<<<<<<<<<
 *             cmaxx = min(cmaxx, x + self.width)
 * 
 */
    __Pyx_INCREF(__pyx_v_x);
    __pyx_t_3 = __pyx_v_x;
    __Pyx_INCREF(__pyx_v_cminx);
    __pyx_t_5 = __pyx_v_cminx;
    __pyx_t_11 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_14 = __pyx_t_3;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_14 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_t_14;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_cminx, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1133
 *         if self.xclipping:
 *             cminx = max(cminx, x)
 *             cmaxx = min(cmaxx, x + self.width)             # <<<<<<<<<<<<<<
 * 
 *         if self.yclipping:
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_14 = PyNumber_Add(__pyx_v_x, __pyx_t_3); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1133, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_v_cmaxx);
    __pyx_t_3 = __pyx_v_cmaxx;
    __pyx_t_11 = PyObject_RichCompare(__pyx_t_14, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1133, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1133, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_5 = __pyx_t_14;
    } else {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = __pyx_t_3;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_cmaxx, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "renpy/display/render.pyx":1131
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))
 * 
 *         if self.xclipping:             # <<<<<<<<<<<<<<
 *             cminx = max(cminx, x)
 *             cmaxx = min(cmaxx, x + self.width)
 */
  }

  /* "renpy/display/render.pyx":1135
 *             cmaxx = min(cmaxx, x + self.width)
 * 
 *         if self.yclipping:             # <<<<<<<<<<<<<<
 *             cminy = max(cminy, y)
 *             cmaxy = min(cmaxx, x + self.height)
 */
  __pyx_t_1 = (__pyx_v_self->yclipping != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1136
 * 
 *         if self.yclipping:
 *             cminy = max(cminy, y)             # <<<<<<<<<<<<<<
 *             cmaxy = min(cmaxx, x + self.height)
 * 
 */
    __Pyx_INCREF(__pyx_v_y);
    __pyx_t_14 = __pyx_v_y;
    __Pyx_INCREF(__pyx_v_cminy);
    __pyx_t_5 = __pyx_v_cminy;
    __pyx_t_11 = PyObject_RichCompare(__pyx_t_14, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1136, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1136, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_3 = __pyx_t_14;
    } 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_14); __pyx_t_14 = 0;
    __pyx_t_14 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_cminy, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "renpy/display/render.pyx":1137
 *         if self.yclipping:
 *             cminy = max(cminy, y)
 *             cmaxy = min(cmaxx, x + self.height)             # <<<<<<<<<<<<<<
 * 
 *         for child, xo, yo, focus, main in self.children:
 */
    __pyx_t_14 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_INCREF(__pyx_v_cmaxx);
    __pyx_t_14 = __pyx_v_cmaxx;
    __pyx_t_11 = PyObject_RichCompare(__pyx_t_3, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1137, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    if (__pyx_t_1) {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = __pyx_t_3;
    } else {
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_5 = __pyx_t_14;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_cmaxy, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1135
 *             cmaxx = min(cmaxx, x + self.width)
 * 
 *         if self.yclipping:             # <<<<<<<<<<<<<<
 *             cminy = max(cminy, y)
 *             cmaxy = min(cmaxx, x + self.height)
 */
  }

  /* "renpy/display/render.pyx":1139
 *             cmaxy = min(cmaxx, x + self.height)
 * 
 *         for child, xo, yo, focus, main in self.children:             # <<<<<<<<<<<<<<
 *             if not focus or not isinstance(child, Render):
 *                 continue
 */
  if (unlikely(__pyx_v_self->children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1139, __pyx_L1_error)
  }
  __pyx_t_3 = __pyx_v_self->children; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1139, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1139, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #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, 1139, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_13);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_14,&__pyx_t_11,&__pyx_t_12,&__pyx_t_10,&__pyx_t_13};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1139, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_14,&__pyx_t_11,&__pyx_t_12,&__pyx_t_10,&__pyx_t_13};
      __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1139, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_9)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_16(__pyx_t_9); if (unlikely(!item)) goto __pyx_L23_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_9), 5) < 0) __PYX_ERR(0, 1139, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L24_unpacking_done;
      __pyx_L23_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1139, __pyx_L1_error)
      __pyx_L24_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_14);
    __pyx_t_14 = 0;
    __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "renpy/display/render.pyx":1140
 * 
 *         for child, xo, yo, focus, main in self.children:
 *             if not focus or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __pyx_t_19 = ((!__pyx_t_2) != 0);
    if (!__pyx_t_19) {
    } else {
      __pyx_t_1 = __pyx_t_19;
      goto __pyx_L26_bool_binop_done;
    }
    __pyx_t_19 = __Pyx_TypeCheck(__pyx_v_child, __pyx_ptype_5renpy_7display_6render_Render); 
    __pyx_t_2 = ((!(__pyx_t_19 != 0)) != 0);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L26_bool_binop_done:;
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":1141
 *         for child, xo, yo, focus, main in self.children:
 *             if not focus or not isinstance(child, Render):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             xo, yo = reverse.transform(xo, yo)
 */
      goto __pyx_L21_continue;

      /* "renpy/display/render.pyx":1140
 * 
 *         for child, xo, yo, focus, main in self.children:
 *             if not focus or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":1143
 *                 continue
 * 
 *             xo, yo = reverse.transform(xo, yo)             # <<<<<<<<<<<<<<
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x + xo, y + yo, screen, focuses)
 * 
 */
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_reverse, __pyx_n_s_transform); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_10 = NULL;
    __pyx_t_17 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_13);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_13, function);
        __pyx_t_17 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_xo, __pyx_v_yo};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_v_xo, __pyx_v_yo};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_17, 2+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1143, __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_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_17, __pyx_v_xo);
      __Pyx_INCREF(__pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_17, __pyx_v_yo);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #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, 1143, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_13 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_12);
      #else
      __pyx_t_13 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1143, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_13 = __pyx_t_16(__pyx_t_10); if (unlikely(!__pyx_t_13)) goto __pyx_L28_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_13);
      index = 1; __pyx_t_12 = __pyx_t_16(__pyx_t_10); if (unlikely(!__pyx_t_12)) goto __pyx_L28_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_10), 2) < 0) __PYX_ERR(0, 1143, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L29_unpacking_done;
      __pyx_L28_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1143, __pyx_L1_error)
      __pyx_L29_unpacking_done:;
    }
    __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_13);
    __pyx_t_13 = 0;
    __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "renpy/display/render.pyx":1144
 * 
 *             xo, yo = reverse.transform(xo, yo)
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x + xo, y + yo, screen, focuses)             # <<<<<<<<<<<<<<
 * 
 *         if self.pass_focuses:
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_take_focuses); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_13 = PyNumber_Add(__pyx_v_x, __pyx_v_xo); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_10 = PyNumber_Add(__pyx_v_y, __pyx_v_yo); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1144, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = NULL;
    __pyx_t_17 = 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_17 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[10] = {__pyx_t_11, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_reverse, __pyx_t_13, __pyx_t_10, __pyx_v_screen, __pyx_v_focuses};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_17, 9+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1144, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[10] = {__pyx_t_11, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_reverse, __pyx_t_13, __pyx_t_10, __pyx_v_screen, __pyx_v_focuses};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_17, 9+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1144, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else
    #endif
    {
      __pyx_t_14 = PyTuple_New(9+__pyx_t_17); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cminx);
      __Pyx_GIVEREF(__pyx_v_cminx);
      PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_17, __pyx_v_cminx);
      __Pyx_INCREF(__pyx_v_cminy);
      __Pyx_GIVEREF(__pyx_v_cminy);
      PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_17, __pyx_v_cminy);
      __Pyx_INCREF(__pyx_v_cmaxx);
      __Pyx_GIVEREF(__pyx_v_cmaxx);
      PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_17, __pyx_v_cmaxx);
      __Pyx_INCREF(__pyx_v_cmaxy);
      __Pyx_GIVEREF(__pyx_v_cmaxy);
      PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_17, __pyx_v_cmaxy);
      __Pyx_INCREF(__pyx_v_reverse);
      __Pyx_GIVEREF(__pyx_v_reverse);
      PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_17, __pyx_v_reverse);
      __Pyx_GIVEREF(__pyx_t_13);
      PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_17, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_10);
      PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_17, __pyx_t_10);
      __Pyx_INCREF(__pyx_v_screen);
      __Pyx_GIVEREF(__pyx_v_screen);
      PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_17, __pyx_v_screen);
      __Pyx_INCREF(__pyx_v_focuses);
      __Pyx_GIVEREF(__pyx_v_focuses);
      PyTuple_SET_ITEM(__pyx_t_14, 8+__pyx_t_17, __pyx_v_focuses);
      __pyx_t_13 = 0;
      __pyx_t_10 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1144, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1139
 *             cmaxy = min(cmaxx, x + self.height)
 * 
 *         for child, xo, yo, focus, main in self.children:             # <<<<<<<<<<<<<<
 *             if not focus or not isinstance(child, Render):
 *                 continue
 */
    __pyx_L21_continue:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1146
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x + xo, y + yo, screen, focuses)
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses)
 */
  __pyx_t_1 = (__pyx_v_self->pass_focuses != Py_None) && (PyList_GET_SIZE(__pyx_v_self->pass_focuses) != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1147
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses)
 * 
 */
    if (unlikely(__pyx_v_self->pass_focuses == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1147, __pyx_L1_error)
    }
    __pyx_t_3 = __pyx_v_self->pass_focuses; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1147, __pyx_L1_error)
      #else
      __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1147, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1148
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses)             # <<<<<<<<<<<<<<
 * 
 *     def focus_at_point(self, x, y, screen): #@DuplicatedSignature
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_take_focuses); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1148, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_14 = NULL;
      __pyx_t_17 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_17 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[10] = {__pyx_t_14, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_reverse, __pyx_v_x, __pyx_v_y, __pyx_v_screen, __pyx_v_focuses};
        __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_17, 9+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[10] = {__pyx_t_14, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_reverse, __pyx_v_x, __pyx_v_y, __pyx_v_screen, __pyx_v_focuses};
        __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_17, 9+__pyx_t_17); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(9+__pyx_t_17); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__pyx_t_14) {
          __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_14); __pyx_t_14 = NULL;
        }
        __Pyx_INCREF(__pyx_v_cminx);
        __Pyx_GIVEREF(__pyx_v_cminx);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_17, __pyx_v_cminx);
        __Pyx_INCREF(__pyx_v_cminy);
        __Pyx_GIVEREF(__pyx_v_cminy);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_17, __pyx_v_cminy);
        __Pyx_INCREF(__pyx_v_cmaxx);
        __Pyx_GIVEREF(__pyx_v_cmaxx);
        PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_17, __pyx_v_cmaxx);
        __Pyx_INCREF(__pyx_v_cmaxy);
        __Pyx_GIVEREF(__pyx_v_cmaxy);
        PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_17, __pyx_v_cmaxy);
        __Pyx_INCREF(__pyx_v_reverse);
        __Pyx_GIVEREF(__pyx_v_reverse);
        PyTuple_SET_ITEM(__pyx_t_10, 4+__pyx_t_17, __pyx_v_reverse);
        __Pyx_INCREF(__pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_10, 5+__pyx_t_17, __pyx_v_x);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_10, 6+__pyx_t_17, __pyx_v_y);
        __Pyx_INCREF(__pyx_v_screen);
        __Pyx_GIVEREF(__pyx_v_screen);
        PyTuple_SET_ITEM(__pyx_t_10, 7+__pyx_t_17, __pyx_v_screen);
        __Pyx_INCREF(__pyx_v_focuses);
        __Pyx_GIVEREF(__pyx_v_focuses);
        PyTuple_SET_ITEM(__pyx_t_10, 8+__pyx_t_17, __pyx_v_focuses);
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1148, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1147
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses)
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1146
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x + xo, y + yo, screen, focuses)
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses)
 */
  }

  /* "renpy/display/render.pyx":1072
 *             self.focuses.append(t)
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         This adds to focuses Focus objects corresponding to the focuses
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __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_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("renpy.display.render.Render.take_focuses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v_x1);
  __Pyx_XDECREF(__pyx_v_y1);
  __Pyx_XDECREF(__pyx_v_x2);
  __Pyx_XDECREF(__pyx_v_y2);
  __Pyx_XDECREF(__pyx_v_minx);
  __Pyx_XDECREF(__pyx_v_miny);
  __Pyx_XDECREF(__pyx_v_maxx);
  __Pyx_XDECREF(__pyx_v_maxy);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_cminx);
  __Pyx_XDECREF(__pyx_v_cminy);
  __Pyx_XDECREF(__pyx_v_cmaxx);
  __Pyx_XDECREF(__pyx_v_cmaxy);
  __Pyx_XDECREF(__pyx_v_reverse);
  __Pyx_XDECREF(__pyx_v_screen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1150
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses)
 * 
 *     def focus_at_point(self, x, y, screen): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         This returns the focus of this object at the given point.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_31focus_at_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_30focus_at_point[] = "\n        This returns the focus of this object at the given point.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_31focus_at_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_screen = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("focus_at_point (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_screen,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_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("focus_at_point", 1, 3, 3, 1); __PYX_ERR(0, 1150, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_screen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("focus_at_point", 1, 3, 3, 2); __PYX_ERR(0, 1150, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "focus_at_point") < 0)) __PYX_ERR(0, 1150, __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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_screen = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("focus_at_point", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1150, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.focus_at_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_30focus_at_point(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_screen);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_30focus_at_point(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_screen) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_h = NULL;
  PyObject *__pyx_v_mx = NULL;
  PyObject *__pyx_v_my = NULL;
  PyObject *__pyx_v_mask = NULL;
  PyObject *__pyx_v_cx = NULL;
  PyObject *__pyx_v_cy = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_cf = 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;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  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;
  PyObject *(*__pyx_t_17)(PyObject *);
  double __pyx_t_18;
  double __pyx_t_19;
  int __pyx_t_20;
  __Pyx_RefNannySetupContext("focus_at_point", 0);
  __Pyx_INCREF(__pyx_v_screen);

  /* "renpy/display/render.pyx":1155
 *         """
 * 
 *         if self.focus_screen is not None:             # <<<<<<<<<<<<<<
 *             screen = self.focus_screen
 * 
 */
  __pyx_t_1 = (__pyx_v_self->focus_screen != Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1156
 * 
 *         if self.focus_screen is not None:
 *             screen = self.focus_screen             # <<<<<<<<<<<<<<
 * 
 *         if self.xclipping:
 */
    __pyx_t_3 = __pyx_v_self->focus_screen;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_screen, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1155
 *         """
 * 
 *         if self.focus_screen is not None:             # <<<<<<<<<<<<<<
 *             screen = self.focus_screen
 * 
 */
  }

  /* "renpy/display/render.pyx":1158
 *             screen = self.focus_screen
 * 
 *         if self.xclipping:             # <<<<<<<<<<<<<<
 *             if x < 0 or x >= self.width:
 *                 return None
 */
  __pyx_t_2 = (__pyx_v_self->xclipping != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1159
 * 
 *         if self.xclipping:
 *             if x < 0 or x >= self.width:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1159, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1160
 *         if self.xclipping:
 *             if x < 0 or x >= self.width:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         if self.yclipping:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;

      /* "renpy/display/render.pyx":1159
 * 
 *         if self.xclipping:
 *             if x < 0 or x >= self.width:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "renpy/display/render.pyx":1158
 *             screen = self.focus_screen
 * 
 *         if self.xclipping:             # <<<<<<<<<<<<<<
 *             if x < 0 or x >= self.width:
 *                 return None
 */
  }

  /* "renpy/display/render.pyx":1162
 *                 return None
 * 
 *         if self.yclipping:             # <<<<<<<<<<<<<<
 *             if y < 0 or y >= self.height:
 *                 return None
 */
  __pyx_t_2 = (__pyx_v_self->yclipping != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1163
 * 
 *         if self.yclipping:
 *             if y < 0 or y >= self.height:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1163, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1163, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1163, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_y, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1163, __pyx_L1_error)
    __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, 1163, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = __pyx_t_1;
    __pyx_L10_bool_binop_done:;
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1164
 *         if self.yclipping:
 *             if y < 0 or y >= self.height:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         if self.operation == IMAGEDISSOLVE:
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;

      /* "renpy/display/render.pyx":1163
 * 
 *         if self.yclipping:
 *             if y < 0 or y >= self.height:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "renpy/display/render.pyx":1162
 *                 return None
 * 
 *         if self.yclipping:             # <<<<<<<<<<<<<<
 *             if y < 0 or y >= self.height:
 *                 return None
 */
  }

  /* "renpy/display/render.pyx":1166
 *                 return None
 * 
 *         if self.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 *             if not self.children[0][0].is_pixel_opaque(x, y):
 *                 return None
 */
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->operation); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_IMAGEDISSOLVE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1166, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1167
 * 
 *         if self.operation == IMAGEDISSOLVE:
 *             if not self.children[0][0].is_pixel_opaque(x, y):             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    if (unlikely(__pyx_v_self->children == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1167, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_self->children, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1167, __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_is_pixel_opaque); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1167, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    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);
        __pyx_t_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1167, __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_4)) {
      PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_x, __pyx_v_y};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1167, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_3) {
        __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
      }
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_y);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1167, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1167, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_1 = ((!__pyx_t_2) != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":1168
 *         if self.operation == IMAGEDISSOLVE:
 *             if not self.children[0][0].is_pixel_opaque(x, y):
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         rv = None
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;

      /* "renpy/display/render.pyx":1167
 * 
 *         if self.operation == IMAGEDISSOLVE:
 *             if not self.children[0][0].is_pixel_opaque(x, y):             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "renpy/display/render.pyx":1166
 *                 return None
 * 
 *         if self.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 *             if not self.children[0][0].is_pixel_opaque(x, y):
 *                 return None
 */
  }

  /* "renpy/display/render.pyx":1170
 *                 return None
 * 
 *         rv = None             # <<<<<<<<<<<<<<
 * 
 *         if self.focuses:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_rv = Py_None;

  /* "renpy/display/render.pyx":1172
 *         rv = None
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 */
  __pyx_t_1 = (__pyx_v_self->focuses != Py_None) && (PyList_GET_SIZE(__pyx_v_self->focuses) != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1173
 * 
 *         if self.focuses:
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
    if (unlikely(__pyx_v_self->focuses == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1173, __pyx_L1_error)
    }
    __pyx_t_5 = __pyx_v_self->focuses; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
    for (;;) {
      if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1173, __pyx_L1_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      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 != 9)) {
          if (size > 9) __Pyx_RaiseTooManyValuesError(9);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1173, __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_3 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 6); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 7); 
          __pyx_t_15 = PyTuple_GET_ITEM(sequence, 8); 
        } else {
          __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 4); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 5); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 6); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 7); 
          __pyx_t_15 = PyList_GET_ITEM(sequence, 8); 
        }
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_15);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[9] = {&__pyx_t_7,&__pyx_t_3,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15};
          for (i=0; i < 9; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1173, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[9] = {&__pyx_t_7,&__pyx_t_3,&__pyx_t_9,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15};
        __pyx_t_16 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 1173, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
        for (index=0; index < 9; index++) {
          PyObject* item = __pyx_t_17(__pyx_t_16); if (unlikely(!item)) goto __pyx_L17_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 9) < 0) __PYX_ERR(0, 1173, __pyx_L1_error)
        __pyx_t_17 = NULL;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        goto __pyx_L18_unpacking_done;
        __pyx_L17_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        __pyx_t_17 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1173, __pyx_L1_error)
        __pyx_L18_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_7);
      __pyx_t_7 = 0;
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_9);
      __pyx_t_9 = 0;
      __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_10);
      __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_w, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mx, __pyx_t_13);
      __pyx_t_13 = 0;
      __Pyx_XDECREF_SET(__pyx_v_my, __pyx_t_14);
      __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mask, __pyx_t_15);
      __pyx_t_15 = 0;

      /* "renpy/display/render.pyx":1175
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_1 = (__pyx_v_xo == Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "renpy/display/render.pyx":1176
 * 
 *                 if xo is None:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 elif mx is not None:
 */
        goto __pyx_L15_continue;

        /* "renpy/display/render.pyx":1175
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      }

      /* "renpy/display/render.pyx":1178
 *                     continue
 * 
 *                 elif mx is not None:             # <<<<<<<<<<<<<<
 *                     cx = x - mx
 *                     cy = y - my
 */
      __pyx_t_2 = (__pyx_v_mx != Py_None);
      __pyx_t_1 = (__pyx_t_2 != 0);
      if (__pyx_t_1) {

        /* "renpy/display/render.pyx":1179
 * 
 *                 elif mx is not None:
 *                     cx = x - mx             # <<<<<<<<<<<<<<
 *                     cy = y - my
 * 
 */
        __pyx_t_4 = PyNumber_Subtract(__pyx_v_x, __pyx_v_mx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1179, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "renpy/display/render.pyx":1180
 *                 elif mx is not None:
 *                     cx = x - mx
 *                     cy = y - my             # <<<<<<<<<<<<<<
 * 
 *                     if self.forward:
 */
        __pyx_t_4 = PyNumber_Subtract(__pyx_v_y, __pyx_v_my); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1180, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "renpy/display/render.pyx":1182
 *                     cy = y - my
 * 
 *                     if self.forward:             # <<<<<<<<<<<<<<
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 */
        __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->forward)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error)
        if (__pyx_t_1) {

          /* "renpy/display/render.pyx":1183
 * 
 *                     if self.forward:
 *                         cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *                     if isinstance(mask, Render):
 */
          __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_v_cx); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1183, __pyx_L1_error)
          __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_v_cy); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1183, __pyx_L1_error)
          __pyx_t_4 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_self->forward->__pyx_vtab)->transform(__pyx_v_self->forward, __pyx_t_18, __pyx_t_19, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1183, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          if (likely(__pyx_t_4 != Py_None)) {
            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 != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 1183, __pyx_L1_error)
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(__pyx_t_14);
            #else
            __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1183, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1183, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else {
            __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1183, __pyx_L1_error)
          }
          __Pyx_DECREF_SET(__pyx_v_cx, __pyx_t_15);
          __pyx_t_15 = 0;
          __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_14);
          __pyx_t_14 = 0;

          /* "renpy/display/render.pyx":1182
 *                     cy = y - my
 * 
 *                     if self.forward:             # <<<<<<<<<<<<<<
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 */
        }

        /* "renpy/display/render.pyx":1185
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 *                     if isinstance(mask, Render):             # <<<<<<<<<<<<<<
 *                         if mask.is_pixel_opaque(cx, cy):
 *                             rv = d, arg, screen
 */
        __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_mask, __pyx_ptype_5renpy_7display_6render_Render); 
        __pyx_t_2 = (__pyx_t_1 != 0);
        if (__pyx_t_2) {

          /* "renpy/display/render.pyx":1186
 * 
 *                     if isinstance(mask, Render):
 *                         if mask.is_pixel_opaque(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 *                     else:
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s_is_pixel_opaque); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1186, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_15 = NULL;
          __pyx_t_6 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_15)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_15);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
              __pyx_t_6 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_14)) {
            PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1186, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
            PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1186, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else
          #endif
          {
            __pyx_t_13 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1186, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            if (__pyx_t_15) {
              __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_15); __pyx_t_15 = NULL;
            }
            __Pyx_INCREF(__pyx_v_cx);
            __Pyx_GIVEREF(__pyx_v_cx);
            PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_v_cx);
            __Pyx_INCREF(__pyx_v_cy);
            __Pyx_GIVEREF(__pyx_v_cy);
            PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_v_cy);
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1186, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1186, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_2) {

            /* "renpy/display/render.pyx":1187
 *                     if isinstance(mask, Render):
 *                         if mask.is_pixel_opaque(cx, cy):
 *                             rv = d, arg, screen             # <<<<<<<<<<<<<<
 *                     else:
 *                         if mask(cx, cy):
 */
            __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1187, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_INCREF(__pyx_v_d);
            __Pyx_GIVEREF(__pyx_v_d);
            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_d);
            __Pyx_INCREF(__pyx_v_arg);
            __Pyx_GIVEREF(__pyx_v_arg);
            PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_arg);
            __Pyx_INCREF(__pyx_v_screen);
            __Pyx_GIVEREF(__pyx_v_screen);
            PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_screen);
            __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_4);
            __pyx_t_4 = 0;

            /* "renpy/display/render.pyx":1186
 * 
 *                     if isinstance(mask, Render):
 *                         if mask.is_pixel_opaque(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 *                     else:
 */
          }

          /* "renpy/display/render.pyx":1185
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 *                     if isinstance(mask, Render):             # <<<<<<<<<<<<<<
 *                         if mask.is_pixel_opaque(cx, cy):
 *                             rv = d, arg, screen
 */
          goto __pyx_L21;
        }

        /* "renpy/display/render.pyx":1189
 *                             rv = d, arg, screen
 *                     else:
 *                         if mask(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 * 
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_v_mask);
          __pyx_t_14 = __pyx_v_mask; __pyx_t_13 = NULL;
          __pyx_t_6 = 0;
          if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
              __pyx_t_6 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_14)) {
            PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1189, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
            PyObject *__pyx_temp[3] = {__pyx_t_13, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1189, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else
          #endif
          {
            __pyx_t_15 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1189, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            if (__pyx_t_13) {
              __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_13); __pyx_t_13 = NULL;
            }
            __Pyx_INCREF(__pyx_v_cx);
            __Pyx_GIVEREF(__pyx_v_cx);
            PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_v_cx);
            __Pyx_INCREF(__pyx_v_cy);
            __Pyx_GIVEREF(__pyx_v_cy);
            PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, __pyx_v_cy);
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1189, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1189, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_2) {

            /* "renpy/display/render.pyx":1190
 *                     else:
 *                         if mask(cx, cy):
 *                             rv = d, arg, screen             # <<<<<<<<<<<<<<
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:
 */
            __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1190, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_INCREF(__pyx_v_d);
            __Pyx_GIVEREF(__pyx_v_d);
            PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_d);
            __Pyx_INCREF(__pyx_v_arg);
            __Pyx_GIVEREF(__pyx_v_arg);
            PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_arg);
            __Pyx_INCREF(__pyx_v_screen);
            __Pyx_GIVEREF(__pyx_v_screen);
            PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_screen);
            __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_4);
            __pyx_t_4 = 0;

            /* "renpy/display/render.pyx":1189
 *                             rv = d, arg, screen
 *                     else:
 *                         if mask(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 * 
 */
          }
        }
        __pyx_L21:;

        /* "renpy/display/render.pyx":1178
 *                     continue
 * 
 *                 elif mx is not None:             # <<<<<<<<<<<<<<
 *                     cx = x - mx
 *                     cy = y - my
 */
        goto __pyx_L19;
      }

      /* "renpy/display/render.pyx":1192
 *                             rv = d, arg, screen
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:             # <<<<<<<<<<<<<<
 *                     rv = d, arg, screen
 * 
 */
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_xo, __pyx_v_x, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1192, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_14 = PyNumber_Add(__pyx_v_xo, __pyx_v_w); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1192, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1192, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_1) {
      } else {
        __pyx_t_2 = __pyx_t_1;
        goto __pyx_L24_bool_binop_done;
      }
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_yo, __pyx_v_y, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1192, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_14 = PyNumber_Add(__pyx_v_yo, __pyx_v_h); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1192, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_y, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1192, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1192, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_t_1;
      __pyx_L24_bool_binop_done:;
      if (__pyx_t_2) {

        /* "renpy/display/render.pyx":1193
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:
 *                     rv = d, arg, screen             # <<<<<<<<<<<<<<
 * 
 *         for child, xo, yo, focus, main in self.children:
 */
        __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1193, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_d);
        __Pyx_INCREF(__pyx_v_arg);
        __Pyx_GIVEREF(__pyx_v_arg);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_arg);
        __Pyx_INCREF(__pyx_v_screen);
        __Pyx_GIVEREF(__pyx_v_screen);
        PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_screen);
        __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_4);
        __pyx_t_4 = 0;

        /* "renpy/display/render.pyx":1192
 *                             rv = d, arg, screen
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:             # <<<<<<<<<<<<<<
 *                     rv = d, arg, screen
 * 
 */
      }
      __pyx_L19:;

      /* "renpy/display/render.pyx":1173
 * 
 *         if self.focuses:
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
      __pyx_L15_continue:;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1172
 *         rv = None
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 */
  }

  /* "renpy/display/render.pyx":1195
 *                     rv = d, arg, screen
 * 
 *         for child, xo, yo, focus, main in self.children:             # <<<<<<<<<<<<<<
 * 
 *             if not focus or not isinstance(child, Render):
 */
  if (unlikely(__pyx_v_self->children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1195, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_v_self->children; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1195, __pyx_L1_error)
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1195, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    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 != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1195, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_11);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1195, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_14,&__pyx_t_15,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11};
      __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_17 = Py_TYPE(__pyx_t_10)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_17(__pyx_t_10); if (unlikely(!item)) goto __pyx_L28_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 5) < 0) __PYX_ERR(0, 1195, __pyx_L1_error)
      __pyx_t_17 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L29_unpacking_done;
      __pyx_L28_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_17 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1195, __pyx_L1_error)
      __pyx_L29_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_14);
    __pyx_t_14 = 0;
    __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_15);
    __pyx_t_15 = 0;
    __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_13);
    __pyx_t_13 = 0;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_11);
    __pyx_t_11 = 0;

    /* "renpy/display/render.pyx":1197
 *         for child, xo, yo, focus, main in self.children:
 * 
 *             if not focus or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1197, __pyx_L1_error)
    __pyx_t_20 = ((!__pyx_t_1) != 0);
    if (!__pyx_t_20) {
    } else {
      __pyx_t_2 = __pyx_t_20;
      goto __pyx_L31_bool_binop_done;
    }
    __pyx_t_20 = __Pyx_TypeCheck(__pyx_v_child, __pyx_ptype_5renpy_7display_6render_Render); 
    __pyx_t_1 = ((!(__pyx_t_20 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L31_bool_binop_done:;
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1198
 * 
 *             if not focus or not isinstance(child, Render):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             cx = x - xo
 */
      goto __pyx_L26_continue;

      /* "renpy/display/render.pyx":1197
 *         for child, xo, yo, focus, main in self.children:
 * 
 *             if not focus or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":1200
 *                 continue
 * 
 *             cx = x - xo             # <<<<<<<<<<<<<<
 *             cy = y - yo
 * 
 */
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_x, __pyx_v_xo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1201
 * 
 *             cx = x - xo
 *             cy = y - yo             # <<<<<<<<<<<<<<
 * 
 *             if self.forward:
 */
    __pyx_t_4 = PyNumber_Subtract(__pyx_v_y, __pyx_v_yo); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1201, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1203
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->forward)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1203, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1204
 * 
 *             if self.forward:
 *                 cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *             cf = child.focus_at_point(cx, cy, screen)
 */
      __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_v_cx); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1204, __pyx_L1_error)
      __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_v_cy); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1204, __pyx_L1_error)
      __pyx_t_4 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_self->forward->__pyx_vtab)->transform(__pyx_v_self->forward, __pyx_t_19, __pyx_t_18, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (likely(__pyx_t_4 != Py_None)) {
        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 != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1204, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        #else
        __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1204, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_cx, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_12);
      __pyx_t_12 = 0;

      /* "renpy/display/render.pyx":1203
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    }

    /* "renpy/display/render.pyx":1206
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 *             cf = child.focus_at_point(cx, cy, screen)             # <<<<<<<<<<<<<<
 *             if cf is not None:
 *                 rv = cf
 */
    __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_focus_at_point); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = NULL;
    __pyx_t_6 = 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_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy, __pyx_v_screen};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1206, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy, __pyx_v_screen};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1206, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_13 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cx);
      __Pyx_GIVEREF(__pyx_v_cx);
      PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_v_cx);
      __Pyx_INCREF(__pyx_v_cy);
      __Pyx_GIVEREF(__pyx_v_cy);
      PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_v_cy);
      __Pyx_INCREF(__pyx_v_screen);
      __Pyx_GIVEREF(__pyx_v_screen);
      PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_6, __pyx_v_screen);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1206, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    }
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1207
 * 
 *             cf = child.focus_at_point(cx, cy, screen)
 *             if cf is not None:             # <<<<<<<<<<<<<<
 *                 rv = cf
 * 
 */
    __pyx_t_2 = (__pyx_v_cf != Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":1208
 *             cf = child.focus_at_point(cx, cy, screen)
 *             if cf is not None:
 *                 rv = cf             # <<<<<<<<<<<<<<
 * 
 *         if self.pass_focuses:
 */
      __Pyx_INCREF(__pyx_v_cf);
      __Pyx_DECREF_SET(__pyx_v_rv, __pyx_v_cf);

      /* "renpy/display/render.pyx":1207
 * 
 *             cf = child.focus_at_point(cx, cy, screen)
 *             if cf is not None:             # <<<<<<<<<<<<<<
 *                 rv = cf
 * 
 */
    }

    /* "renpy/display/render.pyx":1195
 *                     rv = d, arg, screen
 * 
 *         for child, xo, yo, focus, main in self.children:             # <<<<<<<<<<<<<<
 * 
 *             if not focus or not isinstance(child, Render):
 */
    __pyx_L26_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/display/render.pyx":1210
 *                 rv = cf
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y, screen)
 */
  __pyx_t_1 = (__pyx_v_self->pass_focuses != Py_None) && (PyList_GET_SIZE(__pyx_v_self->pass_focuses) != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1211
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 cf = child.focus_at_point(x, y, screen)
 *                 if cf is not None:
 */
    if (unlikely(__pyx_v_self->pass_focuses == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1211, __pyx_L1_error)
    }
    __pyx_t_5 = __pyx_v_self->pass_focuses; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
    for (;;) {
      if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 1211, __pyx_L1_error)
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1211, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":1212
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y, screen)             # <<<<<<<<<<<<<<
 *                 if cf is not None:
 *                     rv = cf
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_focus_at_point); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1212, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_v_x, __pyx_v_y, __pyx_v_screen};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[4] = {__pyx_t_13, __pyx_v_x, __pyx_v_y, __pyx_v_screen};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_13) {
          __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13); __pyx_t_13 = NULL;
        }
        __Pyx_INCREF(__pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_6, __pyx_v_x);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_6, __pyx_v_y);
        __Pyx_INCREF(__pyx_v_screen);
        __Pyx_GIVEREF(__pyx_v_screen);
        PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_6, __pyx_v_screen);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1212, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":1213
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y, screen)
 *                 if cf is not None:             # <<<<<<<<<<<<<<
 *                     rv = cf
 * 
 */
      __pyx_t_1 = (__pyx_v_cf != Py_None);
      __pyx_t_2 = (__pyx_t_1 != 0);
      if (__pyx_t_2) {

        /* "renpy/display/render.pyx":1214
 *                 cf = child.focus_at_point(x, y, screen)
 *                 if cf is not None:
 *                     rv = cf             # <<<<<<<<<<<<<<
 * 
 *         if rv is None and self.modal:
 */
        __Pyx_INCREF(__pyx_v_cf);
        __Pyx_DECREF_SET(__pyx_v_rv, __pyx_v_cf);

        /* "renpy/display/render.pyx":1213
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y, screen)
 *                 if cf is not None:             # <<<<<<<<<<<<<<
 *                     rv = cf
 * 
 */
      }

      /* "renpy/display/render.pyx":1211
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 cf = child.focus_at_point(x, y, screen)
 *                 if cf is not None:
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1210
 *                 rv = cf
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y, screen)
 */
  }

  /* "renpy/display/render.pyx":1216
 *                     rv = cf
 * 
 *         if rv is None and self.modal:             # <<<<<<<<<<<<<<
 *             rv = Modal
 * 
 */
  __pyx_t_1 = (__pyx_v_rv == Py_None);
  __pyx_t_20 = (__pyx_t_1 != 0);
  if (__pyx_t_20) {
  } else {
    __pyx_t_2 = __pyx_t_20;
    goto __pyx_L40_bool_binop_done;
  }
  __pyx_t_20 = (__pyx_v_self->modal != 0);
  __pyx_t_2 = __pyx_t_20;
  __pyx_L40_bool_binop_done:;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1217
 * 
 *         if rv is None and self.modal:
 *             rv = Modal             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_Modal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1217, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_rv, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1216
 *                     rv = cf
 * 
 *         if rv is None and self.modal:             # <<<<<<<<<<<<<<
 *             rv = Modal
 * 
 */
  }

  /* "renpy/display/render.pyx":1219
 *             rv = Modal
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1150
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, screen, focuses)
 * 
 *     def focus_at_point(self, x, y, screen): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         This returns the focus of this object at the given point.
 */

  /* 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_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("renpy.display.render.Render.focus_at_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v_cx);
  __Pyx_XDECREF(__pyx_v_cy);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_cf);
  __Pyx_XDECREF(__pyx_v_screen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1222
 * 
 * 
 *     def main_displayables_at_point(self, x, y, layers, depth=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the displayable at `x`, `y` on one of the layers in
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_33main_displayables_at_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_32main_displayables_at_point[] = "\n        Returns the displayable at `x`, `y` on one of the layers in\n        the set or list `layers`.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_33main_displayables_at_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_layers = 0;
  PyObject *__pyx_v_depth = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("main_displayables_at_point (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_layers,&__pyx_n_s_depth,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    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("main_displayables_at_point", 0, 3, 4, 1); __PYX_ERR(0, 1222, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_layers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("main_displayables_at_point", 0, 3, 4, 2); __PYX_ERR(0, 1222, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_depth);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "main_displayables_at_point") < 0)) __PYX_ERR(0, 1222, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_layers = values[2];
    __pyx_v_depth = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("main_displayables_at_point", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1222, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.main_displayables_at_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_32main_displayables_at_point(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_layers, __pyx_v_depth);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_32main_displayables_at_point(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_layers, PyObject *__pyx_v_depth) {
  PyObject *__pyx_v_rv = NULL;
  int __pyx_v_is_screen;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_focus = NULL;
  PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_cx = NULL;
  PyObject *__pyx_v_cy = NULL;
  PyObject *__pyx_v_cf = 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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_t_15;
  double __pyx_t_16;
  double __pyx_t_17;
  int __pyx_t_18;
  __Pyx_RefNannySetupContext("main_displayables_at_point", 0);
  __Pyx_INCREF(__pyx_v_depth);

  /* "renpy/display/render.pyx":1228
 *         """
 * 
 *         rv = [ ]             # <<<<<<<<<<<<<<
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1228, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1230
 *         rv = [ ]
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_t_4, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1230, __pyx_L1_error)
  __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, 1230, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1231
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:
 *             return rv             # <<<<<<<<<<<<<<
 * 
 *         is_screen = False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_rv);
    __pyx_r = __pyx_v_rv;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1230
 *         rv = [ ]
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
  }

  /* "renpy/display/render.pyx":1233
 *             return rv
 * 
 *         is_screen = False             # <<<<<<<<<<<<<<
 * 
 *         if depth is not None:
 */
  __pyx_v_is_screen = 0;

  /* "renpy/display/render.pyx":1235
 *         is_screen = False
 * 
 *         if depth is not None:             # <<<<<<<<<<<<<<
 *             for d in self.render_of:
 *                 rv.append((depth, self.width, self.height, d))
 */
  __pyx_t_2 = (__pyx_v_depth != Py_None);
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1236
 * 
 *         if depth is not None:
 *             for d in self.render_of:             # <<<<<<<<<<<<<<
 *                 rv.append((depth, self.width, self.height, d))
 *                 depth += 1
 */
    if (likely(PyList_CheckExact(__pyx_v_self->render_of)) || PyTuple_CheckExact(__pyx_v_self->render_of)) {
      __pyx_t_1 = __pyx_v_self->render_of; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
      __pyx_t_6 = NULL;
    } else {
      __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->render_of); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1236, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_6)) {
        if (likely(PyList_CheckExact(__pyx_t_1))) {
          if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1236, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1236, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        } else {
          if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1236, __pyx_L1_error)
          #else
          __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1236, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          #endif
        }
      } else {
        __pyx_t_4 = __pyx_t_6(__pyx_t_1);
        if (unlikely(!__pyx_t_4)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 1236, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":1237
 *         if depth is not None:
 *             for d in self.render_of:
 *                 rv.append((depth, self.width, self.height, d))             # <<<<<<<<<<<<<<
 *                 depth += 1
 * 
 */
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1237, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_v_depth);
      __Pyx_GIVEREF(__pyx_v_depth);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_depth);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
      __Pyx_INCREF(__pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_v_d);
      __pyx_t_4 = 0;
      __pyx_t_7 = 0;
      __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_rv, __pyx_t_8); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1237, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "renpy/display/render.pyx":1238
 *             for d in self.render_of:
 *                 rv.append((depth, self.width, self.height, d))
 *                 depth += 1             # <<<<<<<<<<<<<<
 * 
 *                 if isinstance(d, renpy.display.screen.ScreenDisplayable):
 */
      __pyx_t_8 = __Pyx_PyInt_AddObjC(__pyx_v_depth, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1238, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF_SET(__pyx_v_depth, __pyx_t_8);
      __pyx_t_8 = 0;

      /* "renpy/display/render.pyx":1240
 *                 depth += 1
 * 
 *                 if isinstance(d, renpy.display.screen.ScreenDisplayable):             # <<<<<<<<<<<<<<
 *                     is_screen = True
 * 
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_display); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_screen); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1240, __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_ScreenDisplayable); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1240, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_3 = PyObject_IsInstance(__pyx_v_d, __pyx_t_7); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1240, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_2 = (__pyx_t_3 != 0);
      if (__pyx_t_2) {

        /* "renpy/display/render.pyx":1241
 * 
 *                 if isinstance(d, renpy.display.screen.ScreenDisplayable):
 *                     is_screen = True             # <<<<<<<<<<<<<<
 * 
 *         elif self.layer_name in layers:
 */
        __pyx_v_is_screen = 1;

        /* "renpy/display/render.pyx":1240
 *                 depth += 1
 * 
 *                 if isinstance(d, renpy.display.screen.ScreenDisplayable):             # <<<<<<<<<<<<<<
 *                     is_screen = True
 * 
 */
      }

      /* "renpy/display/render.pyx":1236
 * 
 *         if depth is not None:
 *             for d in self.render_of:             # <<<<<<<<<<<<<<
 *                 rv.append((depth, self.width, self.height, d))
 *                 depth += 1
 */
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":1235
 *         is_screen = False
 * 
 *         if depth is not None:             # <<<<<<<<<<<<<<
 *             for d in self.render_of:
 *                 rv.append((depth, self.width, self.height, d))
 */
    goto __pyx_L8;
  }

  /* "renpy/display/render.pyx":1243
 *                     is_screen = True
 * 
 *         elif self.layer_name in layers:             # <<<<<<<<<<<<<<
 *             depth = 0
 * 
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_self->layer_name, __pyx_v_layers, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1243, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1244
 * 
 *         elif self.layer_name in layers:
 *             depth = 0             # <<<<<<<<<<<<<<
 * 
 *         for (child, xo, yo, focus, main) in self.children:
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF_SET(__pyx_v_depth, __pyx_int_0);

    /* "renpy/display/render.pyx":1243
 *                     is_screen = True
 * 
 *         elif self.layer_name in layers:             # <<<<<<<<<<<<<<
 *             depth = 0
 * 
 */
  }
  __pyx_L8:;

  /* "renpy/display/render.pyx":1246
 *             depth = 0
 * 
 *         for (child, xo, yo, focus, main) in self.children:             # <<<<<<<<<<<<<<
 *             if not main or not isinstance(child, Render):
 *                 continue
 */
  if (unlikely(__pyx_v_self->children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1246, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->children; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_7 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 1246, __pyx_L1_error)
    #else
    __pyx_t_7 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #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, 1246, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_12);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_8,&__pyx_t_4,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1246, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_8,&__pyx_t_4,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12};
      __pyx_t_13 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1246, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_14(__pyx_t_13); if (unlikely(!item)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 5) < 0) __PYX_ERR(0, 1246, __pyx_L1_error)
      __pyx_t_14 = NULL;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L15_unpacking_done;
      __pyx_L14_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1246, __pyx_L1_error)
      __pyx_L15_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_10);
    __pyx_t_10 = 0;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_12);
    __pyx_t_12 = 0;

    /* "renpy/display/render.pyx":1247
 * 
 *         for (child, xo, yo, focus, main) in self.children:
 *             if not main or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_main); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1247, __pyx_L1_error)
    __pyx_t_15 = ((!__pyx_t_2) != 0);
    if (!__pyx_t_15) {
    } else {
      __pyx_t_3 = __pyx_t_15;
      goto __pyx_L17_bool_binop_done;
    }
    __pyx_t_15 = __Pyx_TypeCheck(__pyx_v_child, __pyx_ptype_5renpy_7display_6render_Render); 
    __pyx_t_2 = ((!(__pyx_t_15 != 0)) != 0);
    __pyx_t_3 = __pyx_t_2;
    __pyx_L17_bool_binop_done:;
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":1248
 *         for (child, xo, yo, focus, main) in self.children:
 *             if not main or not isinstance(child, Render):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             cx = x - xo
 */
      goto __pyx_L12_continue;

      /* "renpy/display/render.pyx":1247
 * 
 *         for (child, xo, yo, focus, main) in self.children:
 *             if not main or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":1250
 *                 continue
 * 
 *             cx = x - xo             # <<<<<<<<<<<<<<
 *             cy = y - yo
 * 
 */
    __pyx_t_7 = PyNumber_Subtract(__pyx_v_x, __pyx_v_xo); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1250, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "renpy/display/render.pyx":1251
 * 
 *             cx = x - xo
 *             cy = y - yo             # <<<<<<<<<<<<<<
 * 
 *             if self.forward:
 */
    __pyx_t_7 = PyNumber_Subtract(__pyx_v_y, __pyx_v_yo); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1251, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_7);
    __pyx_t_7 = 0;

    /* "renpy/display/render.pyx":1253
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->forward)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1253, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":1254
 * 
 *             if self.forward:
 *                 cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *             if is_screen:
 */
      __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_cx); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1254, __pyx_L1_error)
      __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_v_cy); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1254, __pyx_L1_error)
      __pyx_t_7 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_self->forward->__pyx_vtab)->transform(__pyx_v_self->forward, __pyx_t_16, __pyx_t_17, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1254, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (likely(__pyx_t_7 != Py_None)) {
        PyObject* sequence = __pyx_t_7;
        #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, 1254, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_11);
        #else
        __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1254, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1254, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 1254, __pyx_L1_error)
      }
      __Pyx_DECREF_SET(__pyx_v_cx, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_11);
      __pyx_t_11 = 0;

      /* "renpy/display/render.pyx":1253
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    }

    /* "renpy/display/render.pyx":1256
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 *             if is_screen:             # <<<<<<<<<<<<<<
 *                 # Ignore the fixed at the root of every screen.
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth - 1)
 */
    __pyx_t_3 = (__pyx_v_is_screen != 0);
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":1258
 *             if is_screen:
 *                 # Ignore the fixed at the root of every screen.
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth - 1)             # <<<<<<<<<<<<<<
 *                 rv.extend(cf[1:])
 *             else:
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_main_displayables_at_point); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyInt_SubtractObjC(__pyx_v_depth, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1258, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_10 = NULL;
      __pyx_t_18 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_10)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_10);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_18 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_v_cx, __pyx_v_cy, __pyx_v_layers, __pyx_t_12};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_18, 4+__pyx_t_18); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1258, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[5] = {__pyx_t_10, __pyx_v_cx, __pyx_v_cy, __pyx_v_layers, __pyx_t_12};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_18, 4+__pyx_t_18); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1258, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else
      #endif
      {
        __pyx_t_4 = PyTuple_New(4+__pyx_t_18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_10) {
          __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL;
        }
        __Pyx_INCREF(__pyx_v_cx);
        __Pyx_GIVEREF(__pyx_v_cx);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_18, __pyx_v_cx);
        __Pyx_INCREF(__pyx_v_cy);
        __Pyx_GIVEREF(__pyx_v_cy);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_18, __pyx_v_cy);
        __Pyx_INCREF(__pyx_v_layers);
        __Pyx_GIVEREF(__pyx_v_layers);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_18, __pyx_v_layers);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_18, __pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1258, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/display/render.pyx":1259
 *                 # Ignore the fixed at the root of every screen.
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth - 1)
 *                 rv.extend(cf[1:])             # <<<<<<<<<<<<<<
 *             else:
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth)
 */
      __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_cf, 1, 0, NULL, NULL, &__pyx_slice__9, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1259, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_rv, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1259, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "renpy/display/render.pyx":1256
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 *             if is_screen:             # <<<<<<<<<<<<<<
 *                 # Ignore the fixed at the root of every screen.
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth - 1)
 */
      goto __pyx_L20;
    }

    /* "renpy/display/render.pyx":1261
 *                 rv.extend(cf[1:])
 *             else:
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth)             # <<<<<<<<<<<<<<
 *                 rv.extend(cf)
 * 
 */
    /*else*/ {
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_main_displayables_at_point); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1261, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_4 = NULL;
      __pyx_t_18 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_18 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_cx, __pyx_v_cy, __pyx_v_layers, __pyx_v_depth};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_18, 4+__pyx_t_18); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1261, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[5] = {__pyx_t_4, __pyx_v_cx, __pyx_v_cy, __pyx_v_layers, __pyx_v_depth};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_18, 4+__pyx_t_18); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1261, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(4+__pyx_t_18); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1261, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_INCREF(__pyx_v_cx);
        __Pyx_GIVEREF(__pyx_v_cx);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_18, __pyx_v_cx);
        __Pyx_INCREF(__pyx_v_cy);
        __Pyx_GIVEREF(__pyx_v_cy);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_18, __pyx_v_cy);
        __Pyx_INCREF(__pyx_v_layers);
        __Pyx_GIVEREF(__pyx_v_layers);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_18, __pyx_v_layers);
        __Pyx_INCREF(__pyx_v_depth);
        __Pyx_GIVEREF(__pyx_v_depth);
        PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_18, __pyx_v_depth);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1261, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/display/render.pyx":1262
 *             else:
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth)
 *                 rv.extend(cf)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
      __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_rv, __pyx_v_cf); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 1262, __pyx_L1_error)
    }
    __pyx_L20:;

    /* "renpy/display/render.pyx":1246
 *             depth = 0
 * 
 *         for (child, xo, yo, focus, main) in self.children:             # <<<<<<<<<<<<<<
 *             if not main or not isinstance(child, Render):
 *                 continue
 */
    __pyx_L12_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1264
 *                 rv.extend(cf)
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1222
 * 
 * 
 *     def main_displayables_at_point(self, x, y, layers, depth=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the displayable at `x`, `y` on one of the layers in
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("renpy.display.render.Render.main_displayables_at_point", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_cx);
  __Pyx_XDECREF(__pyx_v_cy);
  __Pyx_XDECREF(__pyx_v_cf);
  __Pyx_XDECREF(__pyx_v_depth);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1267
 * 
 * 
 *     def is_opaque(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if this displayable is opaque, or False otherwise.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_35is_opaque(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_34is_opaque[] = "\n        Returns true if this displayable is opaque, or False otherwise.\n        Also sets self.visible_children.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_35is_opaque(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_opaque (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_34is_opaque(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_34is_opaque(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  int __pyx_v_rv;
  PyObject *__pyx_v_vc = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_cw = NULL;
  PyObject *__pyx_v_ch = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __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;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  __Pyx_RefNannySetupContext("is_opaque", 0);

  /* "renpy/display/render.pyx":1273
 *         """
 * 
 *         if self.opaque is not None:             # <<<<<<<<<<<<<<
 *             return self.opaque
 * 
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->opaque); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1274
 * 
 *         if self.opaque is not None:
 *             return self.opaque             # <<<<<<<<<<<<<<
 * 
 *         # A rotated image is never opaque. (This isn't actually true, but it
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->opaque); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1273
 *         """
 * 
 *         if self.opaque is not None:             # <<<<<<<<<<<<<<
 *             return self.opaque
 * 
 */
  }

  /* "renpy/display/render.pyx":1278
 *         # A rotated image is never opaque. (This isn't actually true, but it
 *         # saves us from the expensive calculations require to prove it is.)
 *         if self.forward:             # <<<<<<<<<<<<<<
 *             self.opaque = False
 *             return False
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->forward)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1278, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1279
 *         # saves us from the expensive calculations require to prove it is.)
 *         if self.forward:
 *             self.opaque = False             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_v_self->opaque = 0;

    /* "renpy/display/render.pyx":1280
 *         if self.forward:
 *             self.opaque = False
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         rv = False
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1278
 *         # A rotated image is never opaque. (This isn't actually true, but it
 *         # saves us from the expensive calculations require to prove it is.)
 *         if self.forward:             # <<<<<<<<<<<<<<
 *             self.opaque = False
 *             return False
 */
  }

  /* "renpy/display/render.pyx":1282
 *             return False
 * 
 *         rv = False             # <<<<<<<<<<<<<<
 *         vc = [ ]
 * 
 */
  __pyx_v_rv = 0;

  /* "renpy/display/render.pyx":1283
 * 
 *         rv = False
 *         vc = [ ]             # <<<<<<<<<<<<<<
 * 
 *         for i in self.children:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1283, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1285
 *         vc = [ ]
 * 
 *         for i in self.children:             # <<<<<<<<<<<<<<
 *             child, xo, yo, focus, main = i
 * 
 */
  if (unlikely(__pyx_v_self->children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1285, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_v_self->children; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1285, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1286
 * 
 *         for i in self.children:
 *             child, xo, yo, focus, main = i             # <<<<<<<<<<<<<<
 * 
 *             if xo <= 0 and yo <= 0:
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_i))) || (PyList_CheckExact(__pyx_v_i))) {
      PyObject* sequence = __pyx_v_i;
      #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, 1286, __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_6 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1286, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_5,&__pyx_t_6,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
      __pyx_t_10 = PyObject_GetIter(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1286, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_11(__pyx_t_10); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 5) < 0) __PYX_ERR(0, 1286, __pyx_L1_error)
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1286, __pyx_L1_error)
      __pyx_L8_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "renpy/display/render.pyx":1288
 *             child, xo, yo, focus, main = i
 * 
 *             if xo <= 0 and yo <= 0:             # <<<<<<<<<<<<<<
 *                 cw, ch = child.get_size()
 *                 if cw + xo < self.width or ch + yo < self.height:
 */
    __pyx_t_9 = PyObject_RichCompare(__pyx_v_xo, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1288, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1288, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L10_bool_binop_done;
    }
    __pyx_t_9 = PyObject_RichCompare(__pyx_v_yo, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1288, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1288, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_3 = __pyx_t_2;
    __pyx_L10_bool_binop_done:;
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":1289
 * 
 *             if xo <= 0 and yo <= 0:
 *                 cw, ch = child.get_size()             # <<<<<<<<<<<<<<
 *                 if cw + xo < self.width or ch + yo < self.height:
 *                     if child.is_opaque():
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_get_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1289, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1289, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1289, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
        PyObject* sequence = __pyx_t_9;
        #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
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_7);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1289, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1289, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        #endif
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_6 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1289, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_8)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_7 = __pyx_t_11(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_6), 2) < 0) __PYX_ERR(0, 1289, __pyx_L1_error)
        __pyx_t_11 = NULL;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        goto __pyx_L13_unpacking_done;
        __pyx_L12_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_11 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1289, __pyx_L1_error)
        __pyx_L13_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_cw, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_ch, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/display/render.pyx":1290
 *             if xo <= 0 and yo <= 0:
 *                 cw, ch = child.get_size()
 *                 if cw + xo < self.width or ch + yo < self.height:             # <<<<<<<<<<<<<<
 *                     if child.is_opaque():
 *                         vc = [ ]
 */
      __pyx_t_9 = PyNumber_Add(__pyx_v_cw, __pyx_v_xo); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_9, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!__pyx_t_2) {
      } else {
        __pyx_t_3 = __pyx_t_2;
        goto __pyx_L15_bool_binop_done;
      }
      __pyx_t_8 = PyNumber_Add(__pyx_v_ch, __pyx_v_yo); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_8, __pyx_t_7, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1290, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_3 = __pyx_t_2;
      __pyx_L15_bool_binop_done:;
      if (__pyx_t_3) {

        /* "renpy/display/render.pyx":1291
 *                 cw, ch = child.get_size()
 *                 if cw + xo < self.width or ch + yo < self.height:
 *                     if child.is_opaque():             # <<<<<<<<<<<<<<
 *                         vc = [ ]
 *                         rv = True
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_is_opaque); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1291, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __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_9 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1291, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        } else {
          __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1291, __pyx_L1_error)
        }
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1291, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_3) {

          /* "renpy/display/render.pyx":1292
 *                 if cw + xo < self.width or ch + yo < self.height:
 *                     if child.is_opaque():
 *                         vc = [ ]             # <<<<<<<<<<<<<<
 *                         rv = True
 * 
 */
          __pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1292, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_9);
          __Pyx_DECREF_SET(__pyx_v_vc, ((PyObject*)__pyx_t_9));
          __pyx_t_9 = 0;

          /* "renpy/display/render.pyx":1293
 *                     if child.is_opaque():
 *                         vc = [ ]
 *                         rv = True             # <<<<<<<<<<<<<<
 * 
 *             vc.append(i)
 */
          __pyx_v_rv = 1;

          /* "renpy/display/render.pyx":1291
 *                 cw, ch = child.get_size()
 *                 if cw + xo < self.width or ch + yo < self.height:
 *                     if child.is_opaque():             # <<<<<<<<<<<<<<
 *                         vc = [ ]
 *                         rv = True
 */
        }

        /* "renpy/display/render.pyx":1290
 *             if xo <= 0 and yo <= 0:
 *                 cw, ch = child.get_size()
 *                 if cw + xo < self.width or ch + yo < self.height:             # <<<<<<<<<<<<<<
 *                     if child.is_opaque():
 *                         vc = [ ]
 */
      }

      /* "renpy/display/render.pyx":1288
 *             child, xo, yo, focus, main = i
 * 
 *             if xo <= 0 and yo <= 0:             # <<<<<<<<<<<<<<
 *                 cw, ch = child.get_size()
 *                 if cw + xo < self.width or ch + yo < self.height:
 */
    }

    /* "renpy/display/render.pyx":1295
 *                         rv = True
 * 
 *             vc.append(i)             # <<<<<<<<<<<<<<
 * 
 *         self.visible_children = vc
 */
    __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_vc, __pyx_v_i); if (unlikely(__pyx_t_12 == ((int)-1))) __PYX_ERR(0, 1295, __pyx_L1_error)

    /* "renpy/display/render.pyx":1285
 *         vc = [ ]
 * 
 *         for i in self.children:             # <<<<<<<<<<<<<<
 *             child, xo, yo, focus, main = i
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1297
 *             vc.append(i)
 * 
 *         self.visible_children = vc             # <<<<<<<<<<<<<<
 *         self.opaque = rv
 *         return rv
 */
  __Pyx_INCREF(__pyx_v_vc);
  __Pyx_GIVEREF(__pyx_v_vc);
  __Pyx_GOTREF(__pyx_v_self->visible_children);
  __Pyx_DECREF(__pyx_v_self->visible_children);
  __pyx_v_self->visible_children = __pyx_v_vc;

  /* "renpy/display/render.pyx":1298
 * 
 *         self.visible_children = vc
 *         self.opaque = rv             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_v_self->opaque = __pyx_v_rv;

  /* "renpy/display/render.pyx":1299
 *         self.visible_children = vc
 *         self.opaque = rv
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_rv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1299, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1267
 * 
 * 
 *     def is_opaque(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if this displayable is opaque, or False otherwise.
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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.display.render.Render.is_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vc);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_cw);
  __Pyx_XDECREF(__pyx_v_ch);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1302
 * 
 * 
 *     def is_pixel_opaque(self, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Determine if the pixel at x and y is opaque or not.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_37is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_36is_pixel_opaque[] = "\n        Determine if the pixel at x and y is opaque or not.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_37is_pixel_opaque(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("is_pixel_opaque (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("is_pixel_opaque", 1, 2, 2, 1); __PYX_ERR(0, 1302, __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, 1302, __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("is_pixel_opaque", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1302, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.is_pixel_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_36is_pixel_opaque(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_x, __pyx_v_y);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_36is_pixel_opaque(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  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;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("is_pixel_opaque", 0);

  /* "renpy/display/render.pyx":1307
 *         """
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __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, 1307, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1307, __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, 1307, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1307, __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 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1307, __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, 1307, __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, 1307, __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 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1307, __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, 1307, __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, 1307, __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/display/render.pyx":1308
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self.is_opaque():
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1307
 *         """
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  }

  /* "renpy/display/render.pyx":1310
 *             return False
 * 
 *         if self.is_opaque():             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_opaque); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1310, __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_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1310, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1310, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1310, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1311
 * 
 *         if self.is_opaque():
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         return renpy.display.draw.is_pixel_opaque(self, x, y)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1310
 *             return False
 * 
 *         if self.is_opaque():             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "renpy/display/render.pyx":1313
 *             return True
 * 
 *         return renpy.display.draw.is_pixel_opaque(self, x, y)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __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, 1313, __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_draw); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1313, __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_is_pixel_opaque); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 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_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_5)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __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[4] = {__pyx_t_4, ((PyObject *)__pyx_v_self), __pyx_v_x, __pyx_v_y};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_2);
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_4) {
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
    }
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, ((PyObject *)__pyx_v_self));
    __Pyx_INCREF(__pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_x);
    __Pyx_INCREF(__pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_y);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1313, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1302
 * 
 * 
 *     def is_pixel_opaque(self, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Determine if the pixel at x and y is opaque or not.
 */

  /* 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_7);
  __Pyx_AddTraceback("renpy.display.render.Render.is_pixel_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1316
 * 
 * 
 *     def fill(self, color):             # <<<<<<<<<<<<<<
 *         """
 *         Fills this Render with the given color.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_39fill(PyObject *__pyx_v_self, PyObject *__pyx_v_color); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_38fill[] = "\n        Fills this Render with the given color.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_39fill(PyObject *__pyx_v_self, PyObject *__pyx_v_color) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("fill (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_38fill(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_color));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_38fill(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_color) {
  PyObject *__pyx_v_solid = NULL;
  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;
  int __pyx_t_5;
  struct __pyx_opt_args_5renpy_7display_6render_6Render_blit __pyx_t_6;
  __Pyx_RefNannySetupContext("fill", 0);
  __Pyx_INCREF(__pyx_v_color);

  /* "renpy/display/render.pyx":1321
 *         """
 * 
 *         color = renpy.easy.color(color)             # <<<<<<<<<<<<<<
 *         solid = renpy.display.imagelike.Solid(color)
 *         surf = render(solid, self.width, self.height, 0, 0)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1321, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_easy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1321, __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_color); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1321, __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_v_color); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1321, __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_3, __pyx_v_color};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __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);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
      PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_color};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __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);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_color);
      __Pyx_GIVEREF(__pyx_v_color);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_color);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1321, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_color, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1322
 * 
 *         color = renpy.easy.color(color)
 *         solid = renpy.display.imagelike.Solid(color)             # <<<<<<<<<<<<<<
 *         surf = render(solid, self.width, self.height, 0, 0)
 *         self.blit(surf, (0, 0), focus=False, main=False)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1322, __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, 1322, __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_imagelike); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1322, __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_Solid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1322, __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 && likely(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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_color); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1322, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_color};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1322, __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_4)) {
      PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_color};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1322, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_v_color);
      __Pyx_GIVEREF(__pyx_v_color);
      PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_color);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1322, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_solid = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1323
 *         color = renpy.easy.color(color)
 *         solid = renpy.display.imagelike.Solid(color)
 *         surf = render(solid, self.width, self.height, 0, 0)             # <<<<<<<<<<<<<<
 *         self.blit(surf, (0, 0), focus=False, main=False)
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1323, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __pyx_f_5renpy_7display_6render_render(__pyx_v_solid, __pyx_t_1, __pyx_t_4, 0.0, 0.0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1323, __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_surf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1324
 *         solid = renpy.display.imagelike.Solid(color)
 *         surf = render(solid, self.width, self.height, 0, 0)
 *         self.blit(surf, (0, 0), focus=False, main=False)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_6.__pyx_n = 2;
  __pyx_t_6.focus = Py_False;
  __pyx_t_6.main = Py_False;
  __pyx_t_5 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)__pyx_v_self->__pyx_vtab)->blit(__pyx_v_self, __pyx_v_surf, __pyx_tuple__10, 0, &__pyx_t_6); 

  /* "renpy/display/render.pyx":1316
 * 
 * 
 *     def fill(self, color):             # <<<<<<<<<<<<<<
 *         """
 *         Fills this Render with the given color.
 */

  /* 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_AddTraceback("renpy.display.render.Render.fill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_solid);
  __Pyx_XDECREF(__pyx_v_surf);
  __Pyx_XDECREF(__pyx_v_color);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1327
 * 
 * 
 *     def canvas(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a canvas object that draws to this Render.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_41canvas(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_40canvas[] = "\n        Returns a canvas object that draws to this Render.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_41canvas(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("canvas (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_40canvas(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_40canvas(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  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("canvas", 0);

  /* "renpy/display/render.pyx":1332
 *         """
 * 
 *         surf = renpy.display.pgrender.surface((self.width, self.height), True)             # <<<<<<<<<<<<<<
 * 
 *         mutated_surface(surf)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1332, __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, 1332, __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, 1332, __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, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1332, __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, 1332, __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, 1332, __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, 1332, __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, 1332, __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/display/render.pyx":1334
 *         surf = renpy.display.pgrender.surface((self.width, self.height), True)
 * 
 *         mutated_surface(surf)             # <<<<<<<<<<<<<<
 * 
 *         self.blit(surf, (0, 0))
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_mutated_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1334, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __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_v_surf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1334, __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_surf};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1334, __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_surf};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1334, __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, 1334, __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_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, 1334, __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/display/render.pyx":1336
 *         mutated_surface(surf)
 * 
 *         self.blit(surf, (0, 0))             # <<<<<<<<<<<<<<
 * 
 *         return Canvas(surf)
 */
  ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)__pyx_v_self->__pyx_vtab)->blit(__pyx_v_self, __pyx_v_surf, __pyx_tuple__11, 0, NULL);

  /* "renpy/display/render.pyx":1338
 *         self.blit(surf, (0, 0))
 * 
 *         return Canvas(surf)             # <<<<<<<<<<<<<<
 * 
 *     def screen_rect(self, double sx, double sy, Matrix2D transform):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_Canvas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1338, __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_5, __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, 1338, __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_3)) {
      PyObject *__pyx_temp[2] = {__pyx_t_5, __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, 1338, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1338, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_surf);
      __Pyx_GIVEREF(__pyx_v_surf);
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_surf);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1338, __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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1327
 * 
 * 
 *     def canvas(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a canvas object that draws to this Render.
 */

  /* 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.display.render.Render.canvas", __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/display/render.pyx":1340
 *         return Canvas(surf)
 * 
 *     def screen_rect(self, double sx, double sy, Matrix2D transform):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the rectangle, in screen-space coordinates, that will be covered
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_43screen_rect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_42screen_rect[] = "\n        Returns the rectangle, in screen-space coordinates, that will be covered\n        by this render when it's drawn to the screen at sx, sy, with the transform\n        `transform`.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_43screen_rect(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_sx;
  double __pyx_v_sy;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_transform = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("screen_rect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sx,&__pyx_n_s_sy,&__pyx_n_s_transform,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_sx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("screen_rect", 1, 3, 3, 1); __PYX_ERR(0, 1340, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transform)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("screen_rect", 1, 3, 3, 2); __PYX_ERR(0, 1340, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "screen_rect") < 0)) __PYX_ERR(0, 1340, __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_sx = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_sx == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1340, __pyx_L3_error)
    __pyx_v_sy = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_sy == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1340, __pyx_L3_error)
    __pyx_v_transform = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)values[2]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("screen_rect", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1340, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.screen_rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_transform), __pyx_ptype_5renpy_7display_6render_Matrix2D, 1, "transform", 0))) __PYX_ERR(0, 1340, __pyx_L1_error)
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_42screen_rect(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_sx, __pyx_v_sy, __pyx_v_transform);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_42screen_rect(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, double __pyx_v_sx, double __pyx_v_sy, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_transform) {
  double __pyx_v_w;
  double __pyx_v_h;
  double __pyx_v_xdx;
  double __pyx_v_xdy;
  double __pyx_v_ydx;
  double __pyx_v_ydy;
  double __pyx_v_x0;
  double __pyx_v_y0;
  double __pyx_v_x1;
  double __pyx_v_y1;
  double __pyx_v_x2;
  double __pyx_v_y2;
  double __pyx_v_x3;
  double __pyx_v_y3;
  double __pyx_v_minx;
  double __pyx_v_maxx;
  double __pyx_v_miny;
  double __pyx_v_maxy;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  float __pyx_t_4;
  double __pyx_t_5;
  double __pyx_t_6;
  double __pyx_t_7;
  double __pyx_t_8;
  double __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  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("screen_rect", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_transform);

  /* "renpy/display/render.pyx":1347
 *         """
 * 
 *         if transform is None:             # <<<<<<<<<<<<<<
 *             transform = IDENTITY
 * 
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_transform) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1348
 * 
 *         if transform is None:
 *             transform = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         cdef double w = self.width
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) __PYX_ERR(0, 1348, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_transform, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1347
 *         """
 * 
 *         if transform is None:             # <<<<<<<<<<<<<<
 *             transform = IDENTITY
 * 
 */
  }

  /* "renpy/display/render.pyx":1350
 *             transform = IDENTITY
 * 
 *         cdef double w = self.width             # <<<<<<<<<<<<<<
 *         cdef double h = self.height
 * 
 */
  __pyx_t_4 = __pyx_v_self->width;
  __pyx_v_w = __pyx_t_4;

  /* "renpy/display/render.pyx":1351
 * 
 *         cdef double w = self.width
 *         cdef double h = self.height             # <<<<<<<<<<<<<<
 * 
 *         cdef double xdx = transform.xdx
 */
  __pyx_t_4 = __pyx_v_self->height;
  __pyx_v_h = __pyx_t_4;

  /* "renpy/display/render.pyx":1353
 *         cdef double h = self.height
 * 
 *         cdef double xdx = transform.xdx             # <<<<<<<<<<<<<<
 *         cdef double xdy = transform.xdy
 *         cdef double ydx = transform.ydx
 */
  __pyx_t_5 = __pyx_v_transform->xdx;
  __pyx_v_xdx = __pyx_t_5;

  /* "renpy/display/render.pyx":1354
 * 
 *         cdef double xdx = transform.xdx
 *         cdef double xdy = transform.xdy             # <<<<<<<<<<<<<<
 *         cdef double ydx = transform.ydx
 *         cdef double ydy = transform.ydy
 */
  __pyx_t_5 = __pyx_v_transform->xdy;
  __pyx_v_xdy = __pyx_t_5;

  /* "renpy/display/render.pyx":1355
 *         cdef double xdx = transform.xdx
 *         cdef double xdy = transform.xdy
 *         cdef double ydx = transform.ydx             # <<<<<<<<<<<<<<
 *         cdef double ydy = transform.ydy
 * 
 */
  __pyx_t_5 = __pyx_v_transform->ydx;
  __pyx_v_ydx = __pyx_t_5;

  /* "renpy/display/render.pyx":1356
 *         cdef double xdy = transform.xdy
 *         cdef double ydx = transform.ydx
 *         cdef double ydy = transform.ydy             # <<<<<<<<<<<<<<
 * 
 *         # Transform the vertex coordinates to screen-space.
 */
  __pyx_t_5 = __pyx_v_transform->ydy;
  __pyx_v_ydy = __pyx_t_5;

  /* "renpy/display/render.pyx":1359
 * 
 *         # Transform the vertex coordinates to screen-space.
 *         cdef double x0 = sx             # <<<<<<<<<<<<<<
 *         cdef double y0 = sy
 * 
 */
  __pyx_v_x0 = __pyx_v_sx;

  /* "renpy/display/render.pyx":1360
 *         # Transform the vertex coordinates to screen-space.
 *         cdef double x0 = sx
 *         cdef double y0 = sy             # <<<<<<<<<<<<<<
 * 
 *         cdef double x1 = w * xdx + sx
 */
  __pyx_v_y0 = __pyx_v_sy;

  /* "renpy/display/render.pyx":1362
 *         cdef double y0 = sy
 * 
 *         cdef double x1 = w * xdx + sx             # <<<<<<<<<<<<<<
 *         cdef double y1 = w * ydx + sy
 * 
 */
  __pyx_v_x1 = ((__pyx_v_w * __pyx_v_xdx) + __pyx_v_sx);

  /* "renpy/display/render.pyx":1363
 * 
 *         cdef double x1 = w * xdx + sx
 *         cdef double y1 = w * ydx + sy             # <<<<<<<<<<<<<<
 * 
 *         cdef double x2 = h * xdy + sx
 */
  __pyx_v_y1 = ((__pyx_v_w * __pyx_v_ydx) + __pyx_v_sy);

  /* "renpy/display/render.pyx":1365
 *         cdef double y1 = w * ydx + sy
 * 
 *         cdef double x2 = h * xdy + sx             # <<<<<<<<<<<<<<
 *         cdef double y2 = h * ydy + sy
 * 
 */
  __pyx_v_x2 = ((__pyx_v_h * __pyx_v_xdy) + __pyx_v_sx);

  /* "renpy/display/render.pyx":1366
 * 
 *         cdef double x2 = h * xdy + sx
 *         cdef double y2 = h * ydy + sy             # <<<<<<<<<<<<<<
 * 
 *         cdef double x3 = w * xdx + h * xdy + sx
 */
  __pyx_v_y2 = ((__pyx_v_h * __pyx_v_ydy) + __pyx_v_sy);

  /* "renpy/display/render.pyx":1368
 *         cdef double y2 = h * ydy + sy
 * 
 *         cdef double x3 = w * xdx + h * xdy + sx             # <<<<<<<<<<<<<<
 *         cdef double y3 = w * ydx + h * ydy + sy
 * 
 */
  __pyx_v_x3 = (((__pyx_v_w * __pyx_v_xdx) + (__pyx_v_h * __pyx_v_xdy)) + __pyx_v_sx);

  /* "renpy/display/render.pyx":1369
 * 
 *         cdef double x3 = w * xdx + h * xdy + sx
 *         cdef double y3 = w * ydx + h * ydy + sy             # <<<<<<<<<<<<<<
 * 
 *         cdef double minx = min(x0, x1, x2, x3)
 */
  __pyx_v_y3 = (((__pyx_v_w * __pyx_v_ydx) + (__pyx_v_h * __pyx_v_ydy)) + __pyx_v_sy);

  /* "renpy/display/render.pyx":1371
 *         cdef double y3 = w * ydx + h * ydy + sy
 * 
 *         cdef double minx = min(x0, x1, x2, x3)             # <<<<<<<<<<<<<<
 *         cdef double maxx = max(x0, x1, x2, x3)
 *         cdef double miny = min(y0, y1, y2, y3)
 */
  __pyx_t_5 = __pyx_v_x1;
  __pyx_t_6 = __pyx_v_x2;
  __pyx_t_7 = __pyx_v_x3;
  __pyx_t_8 = __pyx_v_x0;
  if (((__pyx_t_5 < __pyx_t_8) != 0)) {
    __pyx_t_9 = __pyx_t_5;
  } else {
    __pyx_t_9 = __pyx_t_8;
  }
  __pyx_t_8 = __pyx_t_9;
  if (((__pyx_t_6 < __pyx_t_8) != 0)) {
    __pyx_t_9 = __pyx_t_6;
  } else {
    __pyx_t_9 = __pyx_t_8;
  }
  __pyx_t_8 = __pyx_t_9;
  if (((__pyx_t_7 < __pyx_t_8) != 0)) {
    __pyx_t_9 = __pyx_t_7;
  } else {
    __pyx_t_9 = __pyx_t_8;
  }
  __pyx_v_minx = __pyx_t_9;

  /* "renpy/display/render.pyx":1372
 * 
 *         cdef double minx = min(x0, x1, x2, x3)
 *         cdef double maxx = max(x0, x1, x2, x3)             # <<<<<<<<<<<<<<
 *         cdef double miny = min(y0, y1, y2, y3)
 *         cdef double maxy = max(y0, y1, y2, y3)
 */
  __pyx_t_9 = __pyx_v_x1;
  __pyx_t_5 = __pyx_v_x2;
  __pyx_t_6 = __pyx_v_x3;
  __pyx_t_7 = __pyx_v_x0;
  if (((__pyx_t_9 > __pyx_t_7) != 0)) {
    __pyx_t_8 = __pyx_t_9;
  } else {
    __pyx_t_8 = __pyx_t_7;
  }
  __pyx_t_7 = __pyx_t_8;
  if (((__pyx_t_5 > __pyx_t_7) != 0)) {
    __pyx_t_8 = __pyx_t_5;
  } else {
    __pyx_t_8 = __pyx_t_7;
  }
  __pyx_t_7 = __pyx_t_8;
  if (((__pyx_t_6 > __pyx_t_7) != 0)) {
    __pyx_t_8 = __pyx_t_6;
  } else {
    __pyx_t_8 = __pyx_t_7;
  }
  __pyx_v_maxx = __pyx_t_8;

  /* "renpy/display/render.pyx":1373
 *         cdef double minx = min(x0, x1, x2, x3)
 *         cdef double maxx = max(x0, x1, x2, x3)
 *         cdef double miny = min(y0, y1, y2, y3)             # <<<<<<<<<<<<<<
 *         cdef double maxy = max(y0, y1, y2, y3)
 * 
 */
  __pyx_t_8 = __pyx_v_y1;
  __pyx_t_9 = __pyx_v_y2;
  __pyx_t_5 = __pyx_v_y3;
  __pyx_t_6 = __pyx_v_y0;
  if (((__pyx_t_8 < __pyx_t_6) != 0)) {
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  __pyx_t_6 = __pyx_t_7;
  if (((__pyx_t_9 < __pyx_t_6) != 0)) {
    __pyx_t_7 = __pyx_t_9;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  __pyx_t_6 = __pyx_t_7;
  if (((__pyx_t_5 < __pyx_t_6) != 0)) {
    __pyx_t_7 = __pyx_t_5;
  } else {
    __pyx_t_7 = __pyx_t_6;
  }
  __pyx_v_miny = __pyx_t_7;

  /* "renpy/display/render.pyx":1374
 *         cdef double maxx = max(x0, x1, x2, x3)
 *         cdef double miny = min(y0, y1, y2, y3)
 *         cdef double maxy = max(y0, y1, y2, y3)             # <<<<<<<<<<<<<<
 * 
 *         return (
 */
  __pyx_t_7 = __pyx_v_y1;
  __pyx_t_8 = __pyx_v_y2;
  __pyx_t_9 = __pyx_v_y3;
  __pyx_t_5 = __pyx_v_y0;
  if (((__pyx_t_7 > __pyx_t_5) != 0)) {
    __pyx_t_6 = __pyx_t_7;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  __pyx_t_5 = __pyx_t_6;
  if (((__pyx_t_8 > __pyx_t_5) != 0)) {
    __pyx_t_6 = __pyx_t_8;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  __pyx_t_5 = __pyx_t_6;
  if (((__pyx_t_9 > __pyx_t_5) != 0)) {
    __pyx_t_6 = __pyx_t_9;
  } else {
    __pyx_t_6 = __pyx_t_5;
  }
  __pyx_v_maxy = __pyx_t_6;

  /* "renpy/display/render.pyx":1376
 *         cdef double maxy = max(y0, y1, y2, y3)
 * 
 *         return (             # <<<<<<<<<<<<<<
 *             int(minx),
 *             int(miny),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "renpy/display/render.pyx":1377
 * 
 *         return (
 *             int(minx),             # <<<<<<<<<<<<<<
 *             int(miny),
 *             int(math.ceil(maxx - minx)),
 */
  __pyx_t_3 = __Pyx_PyInt_FromDouble(__pyx_v_minx); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "renpy/display/render.pyx":1378
 *         return (
 *             int(minx),
 *             int(miny),             # <<<<<<<<<<<<<<
 *             int(math.ceil(maxx - minx)),
 *             int(math.ceil(maxy - miny)),
 */
  __pyx_t_10 = __Pyx_PyInt_FromDouble(__pyx_v_miny); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);

  /* "renpy/display/render.pyx":1379
 *             int(minx),
 *             int(miny),
 *             int(math.ceil(maxx - minx)),             # <<<<<<<<<<<<<<
 *             int(math.ceil(maxy - miny)),
 *             )
 */
  __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_ceil); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyFloat_FromDouble((__pyx_v_maxx - __pyx_v_minx)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_13);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_13, function);
    }
  }
  if (!__pyx_t_14) {
    __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1379, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_GOTREF(__pyx_t_11);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_12};
      __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_12};
      __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    } else
    #endif
    {
      __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = NULL;
      __Pyx_GIVEREF(__pyx_t_12);
      PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1379, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = __Pyx_PyNumber_Int(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1380
 *             int(miny),
 *             int(math.ceil(maxx - minx)),
 *             int(math.ceil(maxy - miny)),             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  __pyx_t_15 = __Pyx_GetModuleGlobalName(__pyx_n_s_math); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_ceil); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
  __pyx_t_15 = PyFloat_FromDouble((__pyx_v_maxy - __pyx_v_miny)); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_t_14 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_14)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  if (!__pyx_t_14) {
    __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_15); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1380, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_GOTREF(__pyx_t_11);
  } else {
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_15};
      __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1380, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
      PyObject *__pyx_temp[2] = {__pyx_t_14, __pyx_t_15};
      __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1380, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_GOTREF(__pyx_t_11);
      __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, 1380, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL;
      __Pyx_GIVEREF(__pyx_t_15);
      PyTuple_SET_ITEM(__pyx_t_16, 0+1, __pyx_t_15);
      __pyx_t_15 = 0;
      __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_16, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1380, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = __Pyx_PyNumber_Int(__pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1377
 * 
 *         return (
 *             int(minx),             # <<<<<<<<<<<<<<
 *             int(miny),
 *             int(math.ceil(maxx - minx)),
 */
  __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_12);
  __pyx_t_3 = 0;
  __pyx_t_10 = 0;
  __pyx_t_13 = 0;
  __pyx_t_12 = 0;
  __pyx_r = __pyx_t_11;
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1340
 *         return Canvas(surf)
 * 
 *     def screen_rect(self, double sx, double sy, Matrix2D transform):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the rectangle, in screen-space coordinates, that will be covered
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_AddTraceback("renpy.display.render.Render.screen_rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_transform);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1383
 *             )
 * 
 *     def place(self, d, x=0, y=0, width=None, height=None, st=None, at=None, render=None, main=True):             # <<<<<<<<<<<<<<
 *         """
 *         Documented in udd.rst.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_45place(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_44place[] = "\n        Documented in udd.rst.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_45place(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_height = 0;
  PyObject *__pyx_v_st = 0;
  PyObject *__pyx_v_at = 0;
  PyObject *__pyx_v_render = 0;
  PyObject *__pyx_v_main = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("place (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_st,&__pyx_n_s_at,&__pyx_n_s_render,&__pyx_n_s_main,0};
    PyObject* values[9] = {0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    values[2] = ((PyObject *)__pyx_int_0);
    values[3] = ((PyObject *)Py_None);
    values[4] = ((PyObject *)Py_None);
    values[5] = ((PyObject *)Py_None);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_None);
    values[8] = ((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  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_d)) != 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_x);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_height);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_st);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_at);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_render);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_main);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "place") < 0)) __PYX_ERR(0, 1383, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_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);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_d = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
    __pyx_v_width = values[3];
    __pyx_v_height = values[4];
    __pyx_v_st = values[5];
    __pyx_v_at = values[6];
    __pyx_v_render = values[7];
    __pyx_v_main = values[8];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("place", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1383, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.place", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_44place(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_d, __pyx_v_x, __pyx_v_y, __pyx_v_width, __pyx_v_height, __pyx_v_st, __pyx_v_at, __pyx_v_render, __pyx_v_main);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_44place(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_d, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_width, PyObject *__pyx_v_height, PyObject *__pyx_v_st, PyObject *__pyx_v_at, PyObject *__pyx_v_render, PyObject *__pyx_v_main) {
  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;
  __Pyx_RefNannySetupContext("place", 0);
  __Pyx_INCREF(__pyx_v_width);
  __Pyx_INCREF(__pyx_v_height);
  __Pyx_INCREF(__pyx_v_st);
  __Pyx_INCREF(__pyx_v_at);
  __Pyx_INCREF(__pyx_v_render);

  /* "renpy/display/render.pyx":1388
 *         """
 * 
 *         if width is None:             # <<<<<<<<<<<<<<
 *             width = self.width
 *         if height is None:
 */
  __pyx_t_1 = (__pyx_v_width == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1389
 * 
 *         if width is None:
 *             width = self.width             # <<<<<<<<<<<<<<
 *         if height is None:
 *             height = self.height
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1389, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_width, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1388
 *         """
 * 
 *         if width is None:             # <<<<<<<<<<<<<<
 *             width = self.width
 *         if height is None:
 */
  }

  /* "renpy/display/render.pyx":1390
 *         if width is None:
 *             width = self.width
 *         if height is None:             # <<<<<<<<<<<<<<
 *             height = self.height
 * 
 */
  __pyx_t_2 = (__pyx_v_height == Py_None);
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1391
 *             width = self.width
 *         if height is None:
 *             height = self.height             # <<<<<<<<<<<<<<
 * 
 *         if render is None:
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1391, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_height, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1390
 *         if width is None:
 *             width = self.width
 *         if height is None:             # <<<<<<<<<<<<<<
 *             height = self.height
 * 
 */
  }

  /* "renpy/display/render.pyx":1393
 *             height = self.height
 * 
 *         if render is None:             # <<<<<<<<<<<<<<
 *             if st is None:
 *                 st = render_st
 */
  __pyx_t_1 = (__pyx_v_render == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1394
 * 
 *         if render is None:
 *             if st is None:             # <<<<<<<<<<<<<<
 *                 st = render_st
 *             if at is None:
 */
    __pyx_t_2 = (__pyx_v_st == Py_None);
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":1395
 *         if render is None:
 *             if st is None:
 *                 st = render_st             # <<<<<<<<<<<<<<
 *             if at is None:
 *                 at = render_at
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_st); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1395, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_st, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "renpy/display/render.pyx":1394
 * 
 *         if render is None:
 *             if st is None:             # <<<<<<<<<<<<<<
 *                 st = render_st
 *             if at is None:
 */
    }

    /* "renpy/display/render.pyx":1396
 *             if st is None:
 *                 st = render_st
 *             if at is None:             # <<<<<<<<<<<<<<
 *                 at = render_at
 * 
 */
    __pyx_t_1 = (__pyx_v_at == Py_None);
    __pyx_t_2 = (__pyx_t_1 != 0);
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1397
 *                 st = render_st
 *             if at is None:
 *                 at = render_at             # <<<<<<<<<<<<<<
 * 
 *             render = renpy.display.render.render(d, width, height, st, at)
 */
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_render_at); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1397, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_at, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "renpy/display/render.pyx":1396
 *             if st is None:
 *                 st = render_st
 *             if at is None:             # <<<<<<<<<<<<<<
 *                 at = render_at
 * 
 */
    }

    /* "renpy/display/render.pyx":1399
 *                 at = render_at
 * 
 *             render = renpy.display.render.render(d, width, height, st, at)             # <<<<<<<<<<<<<<
 * 
 *         d.place(self, x, y, width, height, render, main=main)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1399, __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, 1399, __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_render); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1399, __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_render); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1399, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    __pyx_t_6 = 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_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_v_d, __pyx_v_width, __pyx_v_height, __pyx_v_st, __pyx_v_at};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
      PyObject *__pyx_temp[6] = {__pyx_t_4, __pyx_v_d, __pyx_v_width, __pyx_v_height, __pyx_v_st, __pyx_v_at};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      if (__pyx_t_4) {
        __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_d);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_width);
      __Pyx_INCREF(__pyx_v_height);
      __Pyx_GIVEREF(__pyx_v_height);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_height);
      __Pyx_INCREF(__pyx_v_st);
      __Pyx_GIVEREF(__pyx_v_st);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_6, __pyx_v_st);
      __Pyx_INCREF(__pyx_v_at);
      __Pyx_GIVEREF(__pyx_v_at);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_6, __pyx_v_at);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1399, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_render, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1393
 *             height = self.height
 * 
 *         if render is None:             # <<<<<<<<<<<<<<
 *             if st is None:
 *                 st = render_st
 */
  }

  /* "renpy/display/render.pyx":1401
 *             render = renpy.display.render.render(d, width, height, st, at)
 * 
 *         d.place(self, x, y, width, height, render, main=main)             # <<<<<<<<<<<<<<
 * 
 *     def zoom(self, xzoom, yzoom):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_d, __pyx_n_s_place); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_y);
  __Pyx_INCREF(__pyx_v_width);
  __Pyx_GIVEREF(__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_width);
  __Pyx_INCREF(__pyx_v_height);
  __Pyx_GIVEREF(__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_v_height);
  __Pyx_INCREF(__pyx_v_render);
  __Pyx_GIVEREF(__pyx_v_render);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_v_render);
  __pyx_t_7 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_main, __pyx_v_main) < 0) __PYX_ERR(0, 1401, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1383
 *             )
 * 
 *     def place(self, d, x=0, y=0, width=None, height=None, st=None, at=None, render=None, main=True):             # <<<<<<<<<<<<<<
 *         """
 *         Documented in udd.rst.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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.display.render.Render.place", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_width);
  __Pyx_XDECREF(__pyx_v_height);
  __Pyx_XDECREF(__pyx_v_st);
  __Pyx_XDECREF(__pyx_v_at);
  __Pyx_XDECREF(__pyx_v_render);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1403
 *         d.place(self, x, y, width, height, render, main=main)
 * 
 *     def zoom(self, xzoom, yzoom):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the zoom factor applied to this displayable's children.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_47zoom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_46zoom[] = "\n        Sets the zoom factor applied to this displayable's children.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_47zoom(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_xzoom = 0;
  PyObject *__pyx_v_yzoom = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("zoom (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_xzoom,&__pyx_n_s_yzoom,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_xzoom)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_yzoom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zoom", 1, 2, 2, 1); __PYX_ERR(0, 1403, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "zoom") < 0)) __PYX_ERR(0, 1403, __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_xzoom = values[0];
    __pyx_v_yzoom = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("zoom", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1403, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.zoom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_46zoom(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_xzoom, __pyx_v_yzoom);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_46zoom(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_xzoom, PyObject *__pyx_v_yzoom) {
  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;
  __Pyx_RefNannySetupContext("zoom", 0);

  /* "renpy/display/render.pyx":1407
 *         Sets the zoom factor applied to this displayable's children.
 *         """
 *         if self.reverse is None:             # <<<<<<<<<<<<<<
 *             self.reverse = IDENTITY
 *             self.forward = IDENTITY
 */
  __pyx_t_1 = (((PyObject *)__pyx_v_self->reverse) == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1408
 *         """
 *         if self.reverse is None:
 *             self.reverse = IDENTITY             # <<<<<<<<<<<<<<
 *             self.forward = IDENTITY
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) __PYX_ERR(0, 1408, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->reverse);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->reverse));
    __pyx_v_self->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1409
 *         if self.reverse is None:
 *             self.reverse = IDENTITY
 *             self.forward = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         self.reverse *= Matrix2D(xzoom, 0, 0, yzoom)
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) __PYX_ERR(0, 1409, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->forward);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->forward));
    __pyx_v_self->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1407
 *         Sets the zoom factor applied to this displayable's children.
 *         """
 *         if self.reverse is None:             # <<<<<<<<<<<<<<
 *             self.reverse = IDENTITY
 *             self.forward = IDENTITY
 */
  }

  /* "renpy/display/render.pyx":1411
 *             self.forward = IDENTITY
 * 
 *         self.reverse *= Matrix2D(xzoom, 0, 0, yzoom)             # <<<<<<<<<<<<<<
 * 
 *         if xzoom and yzoom:
 */
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_xzoom);
  __Pyx_GIVEREF(__pyx_v_xzoom);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_xzoom);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_0);
  __Pyx_INCREF(__pyx_v_yzoom);
  __Pyx_GIVEREF(__pyx_v_yzoom);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_yzoom);
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6render_Matrix2D), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_self->reverse), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1411, __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_7display_6render_Matrix2D))))) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_GOTREF(__pyx_v_self->reverse);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reverse));
  __pyx_v_self->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1413
 *         self.reverse *= Matrix2D(xzoom, 0, 0, yzoom)
 * 
 *         if xzoom and yzoom:             # <<<<<<<<<<<<<<
 *             self.forward *= Matrix2D(1.0 / xzoom, 0, 0, 1.0 / yzoom)
 *         else:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_xzoom); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1413, __pyx_L1_error)
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_yzoom); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1413, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1414
 * 
 *         if xzoom and yzoom:
 *             self.forward *= Matrix2D(1.0 / xzoom, 0, 0, 1.0 / yzoom)             # <<<<<<<<<<<<<<
 *         else:
 *             self.forward *= Matrix2D(0, 0, 0, 0)
 */
    __pyx_t_3 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_v_xzoom, 1.0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_v_yzoom, 1.0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1414, __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_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6render_Matrix2D), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1414, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_self->forward), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1414, __pyx_L1_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_7display_6render_Matrix2D))))) __PYX_ERR(0, 1414, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->forward);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->forward));
    __pyx_v_self->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1413
 *         self.reverse *= Matrix2D(xzoom, 0, 0, yzoom)
 * 
 *         if xzoom and yzoom:             # <<<<<<<<<<<<<<
 *             self.forward *= Matrix2D(1.0 / xzoom, 0, 0, 1.0 / yzoom)
 *         else:
 */
    goto __pyx_L4;
  }

  /* "renpy/display/render.pyx":1416
 *             self.forward *= Matrix2D(1.0 / xzoom, 0, 0, 1.0 / yzoom)
 *         else:
 *             self.forward *= Matrix2D(0, 0, 0, 0)             # <<<<<<<<<<<<<<
 * 
 * class Canvas(object):
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6render_Matrix2D), __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_self->forward), __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1416, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) __PYX_ERR(0, 1416, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF(__pyx_v_self->forward);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->forward));
    __pyx_v_self->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "renpy/display/render.pyx":1403
 *         d.place(self, x, y, width, height, render, main=main)
 * 
 *     def zoom(self, xzoom, yzoom):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the zoom factor applied to this displayable's children.
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.display.render.Render.zoom", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":33
 * cdef class Render:
 * 
 *     cdef public bint mark, cache_killed             # <<<<<<<<<<<<<<
 * 
 *     cdef public float width, height
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_4mark_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_4mark_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_4mark___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4mark___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 33, __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.display.render.Render.mark.__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_7display_6render_6Render_4mark_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_4mark_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_7display_6render_6Render_4mark_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_4mark_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 33, __pyx_L1_error)
  __pyx_v_self->mark = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.mark.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12cache_killed_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12cache_killed_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->cache_killed); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 33, __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.display.render.Render.cache_killed.__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_7display_6render_6Render_12cache_killed_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_12cache_killed_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_7display_6render_6Render_12cache_killed_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_12cache_killed_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 33, __pyx_L1_error)
  __pyx_v_self->cache_killed = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.cache_killed.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":35
 *     cdef public bint mark, cache_killed
 * 
 *     cdef public float width, height             # <<<<<<<<<<<<<<
 *     cdef public object layer_name
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5width_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5width_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_5width___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5width___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 35, __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.display.render.Render.width.__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_7display_6render_6Render_5width_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_5width_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_7display_6render_6Render_5width_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_5width_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L1_error)
  __pyx_v_self->width = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.width.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_6height_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_6height_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_6height___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6height___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 35, __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.display.render.Render.height.__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_7display_6render_6Render_6height_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_6height_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_7display_6render_6Render_6height_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_6height_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  float __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L1_error)
  __pyx_v_self->height = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.height.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":36
 * 
 *     cdef public float width, height
 *     cdef public object layer_name             # <<<<<<<<<<<<<<
 * 
 *     cdef public list children
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10layer_name_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10layer_name_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_10layer_name___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10layer_name___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->layer_name);
  __pyx_r = __pyx_v_self->layer_name;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_10layer_name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_10layer_name_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_7display_6render_6Render_10layer_name_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->layer_name);
  __Pyx_DECREF(__pyx_v_self->layer_name);
  __pyx_v_self->layer_name = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_10layer_name_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_10layer_name_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_10layer_name_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->layer_name);
  __Pyx_DECREF(__pyx_v_self->layer_name);
  __pyx_v_self->layer_name = Py_None;

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

/* "renpy/display/render.pxd":38
 *     cdef public object layer_name
 * 
 *     cdef public list children             # <<<<<<<<<<<<<<
 *     cdef public set parents
 *     cdef public list depends_on_list
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_8children_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_8children_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_8children___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8children___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->children);
  __pyx_r = __pyx_v_self->children;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_8children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_8children_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_7display_6render_6Render_8children_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_8children_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", 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->children);
  __Pyx_DECREF(__pyx_v_self->children);
  __pyx_v_self->children = ((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.display.render.Render.children.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_8children_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_8children_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_8children_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_8children_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->children);
  __Pyx_DECREF(__pyx_v_self->children);
  __pyx_v_self->children = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":39
 * 
 *     cdef public list children
 *     cdef public set parents             # <<<<<<<<<<<<<<
 *     cdef public list depends_on_list
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7parents_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7parents_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7parents___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7parents___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->parents);
  __pyx_r = __pyx_v_self->parents;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7parents_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7parents_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_7display_6render_6Render_7parents_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7parents_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PySet_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 39, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->parents);
  __Pyx_DECREF(__pyx_v_self->parents);
  __pyx_v_self->parents = ((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.display.render.Render.parents.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7parents_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7parents_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7parents_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7parents_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->parents);
  __Pyx_DECREF(__pyx_v_self->parents);
  __pyx_v_self->parents = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":40
 *     cdef public list children
 *     cdef public set parents
 *     cdef public list depends_on_list             # <<<<<<<<<<<<<<
 * 
 *     cdef public int operation
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15depends_on_list___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->depends_on_list);
  __pyx_r = __pyx_v_self->depends_on_list;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_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_7display_6render_6Render_15depends_on_list_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 40, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->depends_on_list);
  __Pyx_DECREF(__pyx_v_self->depends_on_list);
  __pyx_v_self->depends_on_list = ((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.display.render.Render.depends_on_list.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->depends_on_list);
  __Pyx_DECREF(__pyx_v_self->depends_on_list);
  __pyx_v_self->depends_on_list = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":42
 *     cdef public list depends_on_list
 * 
 *     cdef public int operation             # <<<<<<<<<<<<<<
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9operation_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9operation_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_9operation___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9operation___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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->operation); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 42, __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.display.render.Render.operation.__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_7display_6render_6Render_9operation_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_9operation_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_7display_6render_6Render_9operation_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_9operation_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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, 42, __pyx_L1_error)
  __pyx_v_self->operation = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.operation.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":43
 * 
 *     cdef public int operation
 *     cdef public double operation_complete             # <<<<<<<<<<<<<<
 *     cdef public bint operation_alpha
 *     cdef public object operation_parameter
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_18operation_complete_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_18operation_complete_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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 = PyFloat_FromDouble(__pyx_v_self->operation_complete); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 43, __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.display.render.Render.operation_complete.__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_7display_6render_6Render_18operation_complete_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_18operation_complete_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_7display_6render_6Render_18operation_complete_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_18operation_complete_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 43, __pyx_L1_error)
  __pyx_v_self->operation_complete = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.operation_complete.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":44
 *     cdef public int operation
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha             # <<<<<<<<<<<<<<
 *     cdef public object operation_parameter
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_15operation_alpha_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_15operation_alpha_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->operation_alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __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.display.render.Render.operation_alpha.__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_7display_6render_6Render_15operation_alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_15operation_alpha_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_7display_6render_6Render_15operation_alpha_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 44, __pyx_L1_error)
  __pyx_v_self->operation_alpha = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.operation_alpha.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":45
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha
 *     cdef public object operation_parameter             # <<<<<<<<<<<<<<
 * 
 *     cdef public Matrix2D forward, reverse
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_19operation_parameter___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->operation_parameter);
  __pyx_r = __pyx_v_self->operation_parameter;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_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_7display_6render_6Render_19operation_parameter_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->operation_parameter);
  __Pyx_DECREF(__pyx_v_self->operation_parameter);
  __pyx_v_self->operation_parameter = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->operation_parameter);
  __Pyx_DECREF(__pyx_v_self->operation_parameter);
  __pyx_v_self->operation_parameter = Py_None;

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

/* "renpy/display/render.pxd":47
 *     cdef public object operation_parameter
 * 
 *     cdef public Matrix2D forward, reverse             # <<<<<<<<<<<<<<
 *     cdef public double alpha
 *     cdef public double over
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7forward_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7forward_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7forward___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7forward___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->forward));
  __pyx_r = ((PyObject *)__pyx_v_self->forward);
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7forward_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7forward_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_7display_6render_6Render_7forward_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7forward_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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_6render_Matrix2D))))) __PYX_ERR(1, 47, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->forward);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->forward));
  __pyx_v_self->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__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.display.render.Render.forward.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7forward_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7forward_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7forward_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7forward_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->forward);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->forward));
  __pyx_v_self->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7reverse_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7reverse_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7reverse___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7reverse___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->reverse));
  __pyx_r = ((PyObject *)__pyx_v_self->reverse);
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7reverse_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7reverse_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_7display_6render_6Render_7reverse_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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_6render_Matrix2D))))) __PYX_ERR(1, 47, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->reverse);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reverse));
  __pyx_v_self->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__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.display.render.Render.reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7reverse_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7reverse_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7reverse_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->reverse);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->reverse));
  __pyx_v_self->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

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

/* "renpy/display/render.pxd":48
 * 
 *     cdef public Matrix2D forward, reverse
 *     cdef public double alpha             # <<<<<<<<<<<<<<
 *     cdef public double over
 *     cdef public object nearest
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5alpha_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5alpha_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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 = PyFloat_FromDouble(__pyx_v_self->alpha); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 48, __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.display.render.Render.alpha.__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_7display_6render_6Render_5alpha_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_5alpha_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_7display_6render_6Render_5alpha_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_5alpha_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error)
  __pyx_v_self->alpha = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.alpha.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":49
 *     cdef public Matrix2D forward, reverse
 *     cdef public double alpha
 *     cdef public double over             # <<<<<<<<<<<<<<
 *     cdef public object nearest
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_4over_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_4over_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_4over___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4over___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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 = PyFloat_FromDouble(__pyx_v_self->over); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 49, __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.display.render.Render.over.__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_7display_6render_6Render_4over_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_4over_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_7display_6render_6Render_4over_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_4over_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 49, __pyx_L1_error)
  __pyx_v_self->over = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.over.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":50
 *     cdef public double alpha
 *     cdef public double over
 *     cdef public object nearest             # <<<<<<<<<<<<<<
 * 
 *     cdef public list focuses
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7nearest_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7nearest_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7nearest___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7nearest___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->nearest);
  __pyx_r = __pyx_v_self->nearest;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7nearest_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7nearest_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_7display_6render_6Render_7nearest_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7nearest_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->nearest);
  __Pyx_DECREF(__pyx_v_self->nearest);
  __pyx_v_self->nearest = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7nearest_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7nearest_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7nearest_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7nearest_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->nearest);
  __Pyx_DECREF(__pyx_v_self->nearest);
  __pyx_v_self->nearest = Py_None;

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

/* "renpy/display/render.pxd":52
 *     cdef public object nearest
 * 
 *     cdef public list focuses             # <<<<<<<<<<<<<<
 *     cdef public list pass_focuses
 *     cdef public object focus_screen
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7focuses_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7focuses_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7focuses___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7focuses___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->focuses);
  __pyx_r = __pyx_v_self->focuses;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7focuses_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7focuses_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_7display_6render_6Render_7focuses_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 52, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->focuses);
  __Pyx_DECREF(__pyx_v_self->focuses);
  __pyx_v_self->focuses = ((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.display.render.Render.focuses.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7focuses_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7focuses_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7focuses_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->focuses);
  __Pyx_DECREF(__pyx_v_self->focuses);
  __pyx_v_self->focuses = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":53
 * 
 *     cdef public list focuses
 *     cdef public list pass_focuses             # <<<<<<<<<<<<<<
 *     cdef public object focus_screen
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12pass_focuses___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->pass_focuses);
  __pyx_r = __pyx_v_self->pass_focuses;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_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_7display_6render_6Render_12pass_focuses_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 53, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->pass_focuses);
  __Pyx_DECREF(__pyx_v_self->pass_focuses);
  __pyx_v_self->pass_focuses = ((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.display.render.Render.pass_focuses.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->pass_focuses);
  __Pyx_DECREF(__pyx_v_self->pass_focuses);
  __pyx_v_self->pass_focuses = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":54
 *     cdef public list focuses
 *     cdef public list pass_focuses
 *     cdef public object focus_screen             # <<<<<<<<<<<<<<
 * 
 *     cdef public object draw_func
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12focus_screen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12focus_screen_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_12focus_screen___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12focus_screen___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->focus_screen);
  __pyx_r = __pyx_v_self->focus_screen;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_12focus_screen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_12focus_screen_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_7display_6render_6Render_12focus_screen_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_12focus_screen_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->focus_screen);
  __Pyx_DECREF(__pyx_v_self->focus_screen);
  __pyx_v_self->focus_screen = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_12focus_screen_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_12focus_screen_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_12focus_screen_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_12focus_screen_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->focus_screen);
  __Pyx_DECREF(__pyx_v_self->focus_screen);
  __pyx_v_self->focus_screen = Py_None;

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

/* "renpy/display/render.pxd":56
 *     cdef public object focus_screen
 * 
 *     cdef public object draw_func             # <<<<<<<<<<<<<<
 *     cdef public object render_of
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9draw_func_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9draw_func_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_9draw_func___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9draw_func___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->draw_func);
  __pyx_r = __pyx_v_self->draw_func;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_9draw_func_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_9draw_func_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_7display_6render_6Render_9draw_func_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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_func);
  __Pyx_DECREF(__pyx_v_self->draw_func);
  __pyx_v_self->draw_func = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_9draw_func_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_9draw_func_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_9draw_func_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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_func);
  __Pyx_DECREF(__pyx_v_self->draw_func);
  __pyx_v_self->draw_func = Py_None;

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

/* "renpy/display/render.pxd":57
 * 
 *     cdef public object draw_func
 *     cdef public object render_of             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint opaque
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9render_of_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9render_of_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_9render_of___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9render_of___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->render_of);
  __pyx_r = __pyx_v_self->render_of;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_9render_of_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_9render_of_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_7display_6render_6Render_9render_of_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->render_of);
  __Pyx_DECREF(__pyx_v_self->render_of);
  __pyx_v_self->render_of = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_9render_of_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_9render_of_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_9render_of_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->render_of);
  __Pyx_DECREF(__pyx_v_self->render_of);
  __pyx_v_self->render_of = Py_None;

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

/* "renpy/display/render.pxd":59
 *     cdef public object render_of
 * 
 *     cdef public bint opaque             # <<<<<<<<<<<<<<
 *     cdef public list visible_children
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_6opaque_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_6opaque_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->opaque); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 59, __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.display.render.Render.opaque.__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_7display_6render_6Render_6opaque_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_6opaque_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_7display_6render_6Render_6opaque_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_6opaque_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 59, __pyx_L1_error)
  __pyx_v_self->opaque = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.opaque.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":60
 * 
 *     cdef public bint opaque
 *     cdef public list visible_children             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint xclipping
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_16visible_children_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_16visible_children_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_16visible_children___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16visible_children___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->visible_children);
  __pyx_r = __pyx_v_self->visible_children;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_16visible_children_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_16visible_children_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_7display_6render_6Render_16visible_children_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 60, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->visible_children);
  __Pyx_DECREF(__pyx_v_self->visible_children);
  __pyx_v_self->visible_children = ((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.display.render.Render.visible_children.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_16visible_children_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_16visible_children_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_16visible_children_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->visible_children);
  __Pyx_DECREF(__pyx_v_self->visible_children);
  __pyx_v_self->visible_children = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":62
 *     cdef public list visible_children
 * 
 *     cdef public bint xclipping             # <<<<<<<<<<<<<<
 *     cdef public bint yclipping
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9xclipping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9xclipping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_9xclipping___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9xclipping___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->xclipping); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 62, __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.display.render.Render.xclipping.__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_7display_6render_6Render_9xclipping_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_9xclipping_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_7display_6render_6Render_9xclipping_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_9xclipping_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 62, __pyx_L1_error)
  __pyx_v_self->xclipping = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.xclipping.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":63
 * 
 *     cdef public bint xclipping
 *     cdef public bint yclipping             # <<<<<<<<<<<<<<
 * 
 *     cdef public object surface, alpha_surface, half_cache
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9yclipping_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_9yclipping_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_9yclipping___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9yclipping___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->yclipping); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 63, __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.display.render.Render.yclipping.__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_7display_6render_6Render_9yclipping_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_9yclipping_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_7display_6render_6Render_9yclipping_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_9yclipping_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 63, __pyx_L1_error)
  __pyx_v_self->yclipping = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.yclipping.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":65
 *     cdef public bint yclipping
 * 
 *     cdef public object surface, alpha_surface, half_cache             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint modal
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7surface_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7surface_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7surface___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7surface___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->surface);
  __pyx_r = __pyx_v_self->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_7display_6render_6Render_7surface_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7surface_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_7display_6render_6Render_7surface_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7surface_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->surface);
  __Pyx_DECREF(__pyx_v_self->surface);
  __pyx_v_self->surface = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_7surface_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7surface_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7surface_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_7surface_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->surface);
  __Pyx_DECREF(__pyx_v_self->surface);
  __pyx_v_self->surface = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_13alpha_surface_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_13alpha_surface_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_13alpha_surface___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->alpha_surface);
  __pyx_r = __pyx_v_self->alpha_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_7display_6render_6Render_13alpha_surface_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_13alpha_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_7display_6render_6Render_13alpha_surface_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->alpha_surface);
  __Pyx_DECREF(__pyx_v_self->alpha_surface);
  __pyx_v_self->alpha_surface = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_13alpha_surface_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_13alpha_surface_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->alpha_surface);
  __Pyx_DECREF(__pyx_v_self->alpha_surface);
  __pyx_v_self->alpha_surface = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10half_cache_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10half_cache_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_10half_cache___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10half_cache___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->half_cache);
  __pyx_r = __pyx_v_self->half_cache;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_10half_cache_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_10half_cache_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_7display_6render_6Render_10half_cache_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__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->half_cache);
  __Pyx_DECREF(__pyx_v_self->half_cache);
  __pyx_v_self->half_cache = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_10half_cache_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_10half_cache_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_10half_cache_4__del__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__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->half_cache);
  __Pyx_DECREF(__pyx_v_self->half_cache);
  __pyx_v_self->half_cache = Py_None;

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

/* "renpy/display/render.pxd":67
 *     cdef public object surface, alpha_surface, half_cache
 * 
 *     cdef public bint modal             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint text_input
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5modal_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_5modal_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_5modal___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5modal___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->modal); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 67, __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.display.render.Render.modal.__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_7display_6render_6Render_5modal_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_5modal_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_7display_6render_6Render_5modal_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_5modal_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 67, __pyx_L1_error)
  __pyx_v_self->modal = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.modal.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":69
 *     cdef public bint modal
 * 
 *     cdef public bint text_input             # <<<<<<<<<<<<<<
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10text_input_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10text_input_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_10text_input___get__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10text_input___get__(struct __pyx_obj_5renpy_7display_6render_Render *__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_PyBool_FromLong(__pyx_v_self->text_input); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 69, __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.display.render.Render.text_input.__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_7display_6render_6Render_10text_input_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_10text_input_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_7display_6render_6Render_10text_input_2__set__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5renpy_7display_6render_6Render_10text_input_2__set__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 69, __pyx_L1_error)
  __pyx_v_self->text_input = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.text_input.__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.alpha, self.alpha_surface, self.cache_killed, self.children, self.depends_on_list, self.draw_func, self.focus_screen, self.focuses, self.forward, self.half_cache, self.height, self.layer_name, self.mark, self.modal, self.nearest, self.opaque, self.operation, self.operation_alpha, self.operation_complete, self.operation_parameter, self.over, self.parents, self.pass_focuses, self.render_of, self.reverse, self.surface, self.text_input, self.visible_children, self.width, self.xclipping, self.yclipping)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_49__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_49__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_7display_6render_6Render_48__reduce_cython__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_48__reduce_cython__(struct __pyx_obj_5renpy_7display_6render_Render *__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;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_t_18;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     cdef bint use_setstate
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.children, self.depends_on_list, self.draw_func, self.focus_screen, self.focuses, self.forward, self.half_cache, self.height, self.layer_name, self.mark, self.modal, self.nearest, self.opaque, self.operation, self.operation_alpha, self.operation_complete, self.operation_parameter, self.over, self.parents, self.pass_focuses, self.render_of, self.reverse, self.surface, self.text_input, self.visible_children, self.width, self.xclipping, self.yclipping)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->alpha); 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->cache_killed); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->height); 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->mark); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->modal); 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->opaque); 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->operation); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_v_self->operation_alpha); 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->operation_complete); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->over); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __pyx_t_11 = __Pyx_PyBool_FromLong(__pyx_v_self->text_input); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_12)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_13 = __Pyx_PyBool_FromLong(__pyx_v_self->xclipping); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = __Pyx_PyBool_FromLong(__pyx_v_self->yclipping); if (unlikely(!__pyx_t_14)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyTuple_New(31); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1);
  __Pyx_INCREF(__pyx_v_self->alpha_surface);
  __Pyx_GIVEREF(__pyx_v_self->alpha_surface);
  PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_self->alpha_surface);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_self->children);
  __Pyx_GIVEREF(__pyx_v_self->children);
  PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_self->children);
  __Pyx_INCREF(__pyx_v_self->depends_on_list);
  __Pyx_GIVEREF(__pyx_v_self->depends_on_list);
  PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_v_self->depends_on_list);
  __Pyx_INCREF(__pyx_v_self->draw_func);
  __Pyx_GIVEREF(__pyx_v_self->draw_func);
  PyTuple_SET_ITEM(__pyx_t_15, 5, __pyx_v_self->draw_func);
  __Pyx_INCREF(__pyx_v_self->focus_screen);
  __Pyx_GIVEREF(__pyx_v_self->focus_screen);
  PyTuple_SET_ITEM(__pyx_t_15, 6, __pyx_v_self->focus_screen);
  __Pyx_INCREF(__pyx_v_self->focuses);
  __Pyx_GIVEREF(__pyx_v_self->focuses);
  PyTuple_SET_ITEM(__pyx_t_15, 7, __pyx_v_self->focuses);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->forward));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->forward));
  PyTuple_SET_ITEM(__pyx_t_15, 8, ((PyObject *)__pyx_v_self->forward));
  __Pyx_INCREF(__pyx_v_self->half_cache);
  __Pyx_GIVEREF(__pyx_v_self->half_cache);
  PyTuple_SET_ITEM(__pyx_t_15, 9, __pyx_v_self->half_cache);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_15, 10, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->layer_name);
  __Pyx_GIVEREF(__pyx_v_self->layer_name);
  PyTuple_SET_ITEM(__pyx_t_15, 11, __pyx_v_self->layer_name);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_15, 12, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_15, 13, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->nearest);
  __Pyx_GIVEREF(__pyx_v_self->nearest);
  PyTuple_SET_ITEM(__pyx_t_15, 14, __pyx_v_self->nearest);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_15, 15, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_15, 16, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_15, 17, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_15, 18, __pyx_t_9);
  __Pyx_INCREF(__pyx_v_self->operation_parameter);
  __Pyx_GIVEREF(__pyx_v_self->operation_parameter);
  PyTuple_SET_ITEM(__pyx_t_15, 19, __pyx_v_self->operation_parameter);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_15, 20, __pyx_t_10);
  __Pyx_INCREF(__pyx_v_self->parents);
  __Pyx_GIVEREF(__pyx_v_self->parents);
  PyTuple_SET_ITEM(__pyx_t_15, 21, __pyx_v_self->parents);
  __Pyx_INCREF(__pyx_v_self->pass_focuses);
  __Pyx_GIVEREF(__pyx_v_self->pass_focuses);
  PyTuple_SET_ITEM(__pyx_t_15, 22, __pyx_v_self->pass_focuses);
  __Pyx_INCREF(__pyx_v_self->render_of);
  __Pyx_GIVEREF(__pyx_v_self->render_of);
  PyTuple_SET_ITEM(__pyx_t_15, 23, __pyx_v_self->render_of);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->reverse));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->reverse));
  PyTuple_SET_ITEM(__pyx_t_15, 24, ((PyObject *)__pyx_v_self->reverse));
  __Pyx_INCREF(__pyx_v_self->surface);
  __Pyx_GIVEREF(__pyx_v_self->surface);
  PyTuple_SET_ITEM(__pyx_t_15, 25, __pyx_v_self->surface);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_15, 26, __pyx_t_11);
  __Pyx_INCREF(__pyx_v_self->visible_children);
  __Pyx_GIVEREF(__pyx_v_self->visible_children);
  PyTuple_SET_ITEM(__pyx_t_15, 27, __pyx_v_self->visible_children);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_15, 28, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_15, 29, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_15, 30, __pyx_t_14);
  __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_t_10 = 0;
  __pyx_t_11 = 0;
  __pyx_t_12 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_15);
  __pyx_t_15 = 0;

  /* "(tree fragment)":4
 *     cdef bint use_setstate
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.children, self.depends_on_list, self.draw_func, self.focus_screen, self.focuses, self.forward, self.half_cache, self.height, self.layer_name, self.mark, self.modal, self.nearest, self.opaque, self.operation, self.operation_alpha, self.operation_complete, self.operation_parameter, self.over, self.parents, self.pass_focuses, self.render_of, self.reverse, self.surface, self.text_input, self.visible_children, self.width, self.xclipping, self.yclipping)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         state += (_dict,)
 */
  __pyx_t_15 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_v__dict = __pyx_t_15;
  __pyx_t_15 = 0;

  /* "(tree fragment)":5
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.children, self.depends_on_list, self.draw_func, self.focus_screen, self.focuses, self.forward, self.half_cache, self.height, self.layer_name, self.mark, self.modal, self.nearest, self.opaque, self.operation, self.operation_alpha, self.operation_complete, self.operation_parameter, self.over, self.parents, self.pass_focuses, self.render_of, self.reverse, self.surface, self.text_input, self.visible_children, self.width, self.xclipping, self.yclipping)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
 */
  __pyx_t_16 = (__pyx_v__dict != Py_None);
  __pyx_t_17 = (__pyx_t_16 != 0);
  if (__pyx_t_17) {

    /* "(tree fragment)":6
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
 */
    __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(__pyx_v__dict);
    __Pyx_GIVEREF(__pyx_v__dict);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v__dict);
    __pyx_t_14 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_15); if (unlikely(!__pyx_t_14)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_14));
    __pyx_t_14 = 0;

    /* "(tree fragment)":7
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.alpha_surface is not None or self.children is not None or self.depends_on_list is not None or self.draw_func is not None or self.focus_screen is not None or self.focuses is not None or self.forward is not None or self.half_cache is not None or self.layer_name is not None or self.nearest is not None or self.operation_parameter is not None or self.parents is not None or self.pass_focuses is not None or self.render_of is not None or self.reverse is not None or self.surface is not None or self.visible_children is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":5
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.children, self.depends_on_list, self.draw_func, self.focus_screen, self.focuses, self.forward, self.half_cache, self.height, self.layer_name, self.mark, self.modal, self.nearest, self.opaque, self.operation, self.operation_alpha, self.operation_complete, self.operation_parameter, self.over, self.parents, self.pass_focuses, self.render_of, self.reverse, self.surface, self.text_input, self.visible_children, self.width, self.xclipping, self.yclipping)
 *     _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.alpha_surface is not None or self.children is not None or self.depends_on_list is not None or self.draw_func is not None or self.focus_screen is not None or self.focuses is not None or self.forward is not None or self.half_cache is not None or self.layer_name is not None or self.nearest is not None or self.operation_parameter is not None or self.parents is not None or self.pass_focuses is not None or self.render_of is not None or self.reverse is not None or self.surface is not None or self.visible_children is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Render, (type(self), 0xc9b528e, None), state
 */
  /*else*/ {
    __pyx_t_16 = (__pyx_v_self->alpha_surface != Py_None);
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->children != ((PyObject*)Py_None));
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (__pyx_v_self->depends_on_list != ((PyObject*)Py_None));
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->draw_func != Py_None);
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (__pyx_v_self->focus_screen != Py_None);
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->focuses != ((PyObject*)Py_None));
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (((PyObject *)__pyx_v_self->forward) != Py_None);
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->half_cache != Py_None);
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (__pyx_v_self->layer_name != Py_None);
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->nearest != Py_None);
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (__pyx_v_self->operation_parameter != Py_None);
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->parents != ((PyObject*)Py_None));
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (__pyx_v_self->pass_focuses != ((PyObject*)Py_None));
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->render_of != Py_None);
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (((PyObject *)__pyx_v_self->reverse) != Py_None);
    __pyx_t_18 = (__pyx_t_16 != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_17 = __pyx_t_18;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_18 = (__pyx_v_self->surface != Py_None);
    __pyx_t_16 = (__pyx_t_18 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_17 = __pyx_t_16;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_16 = (__pyx_v_self->visible_children != ((PyObject*)Py_None));
    __pyx_t_18 = (__pyx_t_16 != 0);
    __pyx_t_17 = __pyx_t_18;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_17;
  }
  __pyx_L3:;

  /* "(tree fragment)":10
 *     else:
 *         use_setstate = self.alpha_surface is not None or self.children is not None or self.depends_on_list is not None or self.draw_func is not None or self.focus_screen is not None or self.focuses is not None or self.forward is not None or self.half_cache is not None or self.layer_name is not None or self.nearest is not None or self.operation_parameter is not None or self.parents is not None or self.pass_focuses is not None or self.render_of is not None or self.reverse is not None or self.surface is not None or self.visible_children is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Render, (type(self), 0xc9b528e, None), state
 *     else:
 */
  __pyx_t_17 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_17) {

    /* "(tree fragment)":11
 *         use_setstate = self.alpha_surface is not None or self.children is not None or self.depends_on_list is not None or self.draw_func is not None or self.focus_screen is not None or self.focuses is not None or self.forward is not None or self.half_cache is not None or self.layer_name is not None or self.nearest is not None or self.operation_parameter is not None or self.parents is not None or self.pass_focuses is not None or self.render_of is not None or self.reverse is not None or self.surface is not None or self.visible_children is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Render, (type(self), 0xc9b528e, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Render, (type(self), 0xc9b528e, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Render); if (unlikely(!__pyx_t_14)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_211505806);
    __Pyx_GIVEREF(__pyx_int_211505806);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_int_211505806);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_15, 2, Py_None);
    __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 11, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_14);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_15);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_v_state);
    __pyx_t_14 = 0;
    __pyx_t_15 = 0;
    __pyx_r = __pyx_t_13;
    __pyx_t_13 = 0;
    goto __pyx_L0;

    /* "(tree fragment)":10
 *     else:
 *         use_setstate = self.alpha_surface is not None or self.children is not None or self.depends_on_list is not None or self.draw_func is not None or self.focus_screen is not None or self.focuses is not None or self.forward is not None or self.half_cache is not None or self.layer_name is not None or self.nearest is not None or self.operation_parameter is not None or self.parents is not None or self.pass_focuses is not None or self.render_of is not None or self.reverse is not None or self.surface is not None or self.visible_children is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Render, (type(self), 0xc9b528e, None), state
 *     else:
 */
  }

  /* "(tree fragment)":13
 *         return __pyx_unpickle_Render, (type(self), 0xc9b528e, None), state
 *     else:
 *         return __pyx_unpickle_Render, (type(self), 0xc9b528e, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Render__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Render); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
    __Pyx_INCREF(__pyx_int_211505806);
    __Pyx_GIVEREF(__pyx_int_211505806);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_int_211505806);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_state);
    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_15);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_15);
    __pyx_t_13 = 0;
    __pyx_t_15 = 0;
    __pyx_r = __pyx_t_14;
    __pyx_t_14 = 0;
    goto __pyx_L0;
  }

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef bint use_setstate
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.children, self.depends_on_list, self.draw_func, self.focus_screen, self.focuses, self.forward, self.half_cache, self.height, self.layer_name, self.mark, self.modal, self.nearest, self.opaque, self.operation, self.operation_alpha, self.operation_complete, self.operation_parameter, self.over, self.parents, self.pass_focuses, self.render_of, self.reverse, self.surface, self.text_input, self.visible_children, self.width, self.xclipping, self.yclipping)
 */

  /* 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_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("renpy.display.render.Render.__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_Render, (type(self), 0xc9b528e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Render__set_state(self, __pyx_state)
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_51__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_51__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_7display_6render_6Render_50__setstate_cython__(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_50__setstate_cython__(struct __pyx_obj_5renpy_7display_6render_Render *__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_Render, (type(self), 0xc9b528e, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Render__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_7display_6render___pyx_unpickle_Render__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_Render, (type(self), 0xc9b528e, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_Render__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.display.render.Render.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1420
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_1__init__ = {"__init__", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_surf = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_surf,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_surf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1420, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 1420, __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_surf = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1420, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas___init__(__pyx_self, __pyx_v_self, __pyx_v_surf);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "renpy/display/render.pyx":1421
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 *         self.surf = surf             # <<<<<<<<<<<<<<
 * 
 *     def rect(self, color, rect, width=0):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_surf, __pyx_v_surf) < 0) __PYX_ERR(0, 1421, __pyx_L1_error)

  /* "renpy/display/render.pyx":1420
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1423
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_3rect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_3rect = {"rect", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_3rect, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_3rect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("rect (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_rect,&__pyx_n_s_width,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)__pyx_int_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_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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rect", 0, 3, 4, 1); __PYX_ERR(0, 1423, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rect)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rect", 0, 3, 4, 2); __PYX_ERR(0, 1423, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "rect") < 0)) __PYX_ERR(0, 1423, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_rect = values[2];
    __pyx_v_width = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("rect", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1423, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_2rect(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_rect, __pyx_v_width);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_2rect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_rect, PyObject *__pyx_v_width) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("rect", 0);

  /* "renpy/display/render.pyx":1425
 *     def rect(self, color, rect, width=0):
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1426
 * 
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.rect(self.surf,
 *                              renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1426, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1426, __pyx_L4_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, 1426, __pyx_L4_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, 1426, __pyx_L4_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/display/render.pyx":1427
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,             # <<<<<<<<<<<<<<
 *                              renpy.easy.color(color),
 *                              rect,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1427, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1427, __pyx_L4_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_rect); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1427, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1427, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1428
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,
 *                              renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                              rect,
 *                              width)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1428, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1428, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1428, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1428, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1430
 *                              renpy.easy.color(color),
 *                              rect,
 *                              width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[5] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_rect, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[5] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_rect, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1427, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_rect);
      __Pyx_GIVEREF(__pyx_v_rect);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_rect);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1427, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1432
 *                              width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def polygon(self, color, pointlist, width=0):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1432, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1432, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1432, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1432, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1432, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1432, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1432, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1423
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.rect", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1434
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_5polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_5polygon = {"polygon", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_5polygon, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_5polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_pointlist = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("polygon (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_pointlist,&__pyx_n_s_width,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)__pyx_int_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_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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polygon", 0, 3, 4, 1); __PYX_ERR(0, 1434, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pointlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polygon", 0, 3, 4, 2); __PYX_ERR(0, 1434, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "polygon") < 0)) __PYX_ERR(0, 1434, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_pointlist = values[2];
    __pyx_v_width = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("polygon", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1434, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.polygon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_4polygon(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_pointlist, __pyx_v_width);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_4polygon(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_pointlist, PyObject *__pyx_v_width) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("polygon", 0);

  /* "renpy/display/render.pyx":1435
 * 
 *     def polygon(self, color, pointlist, width=0):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1436
 *     def polygon(self, color, pointlist, width=0):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.polygon(self.surf,
 *                                 renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1436, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1436, __pyx_L4_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, 1436, __pyx_L4_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, 1436, __pyx_L4_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/display/render.pyx":1437
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 pointlist,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1437, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L4_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_polygon); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1437, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1437, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1438
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 pointlist,
 *                                 width)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1438, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1438, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1438, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1438, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1438, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1438, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1438, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1438, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1440
 *                                 renpy.easy.color(color),
 *                                 pointlist,
 *                                 width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[5] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_pointlist, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1437, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[5] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_pointlist, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1437, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1437, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_pointlist);
      __Pyx_GIVEREF(__pyx_v_pointlist);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_pointlist);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1437, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1442
 *                                 width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def circle(self, color, pos, radius, width=0):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1442, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1442, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1442, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1442, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1434
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.polygon", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1444
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_7circle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_7circle = {"circle", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_7circle, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_7circle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_radius = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("circle (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_pos,&__pyx_n_s_radius,&__pyx_n_s_width,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)__pyx_int_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  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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 1); __PYX_ERR(0, 1444, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 2); __PYX_ERR(0, 1444, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_radius)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 3); __PYX_ERR(0, 1444, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "circle") < 0)) __PYX_ERR(0, 1444, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_pos = values[2];
    __pyx_v_radius = values[3];
    __pyx_v_width = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1444, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.circle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_6circle(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_pos, __pyx_v_radius, __pyx_v_width);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_6circle(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_pos, PyObject *__pyx_v_radius, PyObject *__pyx_v_width) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("circle", 0);

  /* "renpy/display/render.pyx":1446
 *     def circle(self, color, pos, radius, width=0):
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1447
 * 
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.circle(self.surf,
 *                                renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1447, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1447, __pyx_L4_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, 1447, __pyx_L4_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, 1447, __pyx_L4_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/display/render.pyx":1448
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,             # <<<<<<<<<<<<<<
 *                                renpy.easy.color(color),
 *                                pos,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1448, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1448, __pyx_L4_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_circle); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1448, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1448, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1449
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,
 *                                renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                pos,
 *                                radius,
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1449, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1449, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1449, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1449, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1449, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1449, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1449, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1449, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1452
 *                                pos,
 *                                radius,
 *                                width)             # <<<<<<<<<<<<<<
 * 
 *         finally:
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_pos, __pyx_v_radius, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_pos, __pyx_v_radius, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1448, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_pos);
      __Pyx_GIVEREF(__pyx_v_pos);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_pos);
      __Pyx_INCREF(__pyx_v_radius);
      __Pyx_GIVEREF(__pyx_v_radius);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_radius);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1448, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1455
 * 
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def ellipse(self, color, rect, width=0):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1455, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1455, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1455, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1455, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1444
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.circle", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1457
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_9ellipse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_9ellipse = {"ellipse", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_9ellipse, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_9ellipse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ellipse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_rect,&__pyx_n_s_width,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)__pyx_int_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_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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellipse", 0, 3, 4, 1); __PYX_ERR(0, 1457, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rect)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellipse", 0, 3, 4, 2); __PYX_ERR(0, 1457, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ellipse") < 0)) __PYX_ERR(0, 1457, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_rect = values[2];
    __pyx_v_width = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("ellipse", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1457, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.ellipse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_8ellipse(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_rect, __pyx_v_width);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_8ellipse(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_rect, PyObject *__pyx_v_width) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("ellipse", 0);

  /* "renpy/display/render.pyx":1458
 * 
 *     def ellipse(self, color, rect, width=0):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1459
 *     def ellipse(self, color, rect, width=0):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.ellipse(self.surf,
 *                                 renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1459, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1459, __pyx_L4_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, 1459, __pyx_L4_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, 1459, __pyx_L4_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/display/render.pyx":1460
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 rect,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1460, __pyx_L4_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_ellipse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1460, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1460, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1461
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 rect,
 *                                 width)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1461, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1461, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1461, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1461, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1461, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1461, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1461, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1461, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1463
 *                                 renpy.easy.color(color),
 *                                 rect,
 *                                 width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[5] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_rect, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1460, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[5] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_rect, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1460, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1460, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_rect);
      __Pyx_GIVEREF(__pyx_v_rect);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_rect);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1460, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1465
 *                                 width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1465, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1465, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1465, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1465, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1465, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1465, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1457
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.ellipse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1468
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_11arc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_11arc = {"arc", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_11arc, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_11arc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_start_angle = 0;
  PyObject *__pyx_v_stop_angle = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("arc (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_rect,&__pyx_n_s_start_angle,&__pyx_n_s_stop_angle,&__pyx_n_s_width,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[5] = ((PyObject *)((PyObject *)__pyx_int_1));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 1); __PYX_ERR(0, 1468, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rect)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 2); __PYX_ERR(0, 1468, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_angle)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 3); __PYX_ERR(0, 1468, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stop_angle)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 4); __PYX_ERR(0, 1468, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "arc") < 0)) __PYX_ERR(0, 1468, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_rect = values[2];
    __pyx_v_start_angle = values[3];
    __pyx_v_stop_angle = values[4];
    __pyx_v_width = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1468, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.arc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_10arc(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_rect, __pyx_v_start_angle, __pyx_v_stop_angle, __pyx_v_width);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_10arc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_rect, PyObject *__pyx_v_start_angle, PyObject *__pyx_v_stop_angle, PyObject *__pyx_v_width) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("arc", 0);

  /* "renpy/display/render.pyx":1469
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.arc(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1470
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.arc(self.surf,
 *                             renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1470, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1470, __pyx_L4_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, 1470, __pyx_L4_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, 1470, __pyx_L4_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/display/render.pyx":1471
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.arc(self.surf,             # <<<<<<<<<<<<<<
 *                             renpy.easy.color(color),
 *                             rect,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1471, __pyx_L4_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_arc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1471, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1472
 *             blit_lock.acquire()
 *             pygame.draw.arc(self.surf,
 *                             renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                             rect,
 *                             start_angle,
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1472, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1472, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1472, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1472, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1472, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1472, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1472, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1472, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1476
 *                             start_angle,
 *                             stop_angle,
 *                             width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[7] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_rect, __pyx_v_start_angle, __pyx_v_stop_angle, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[7] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_rect, __pyx_v_start_angle, __pyx_v_stop_angle, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1471, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_rect);
      __Pyx_GIVEREF(__pyx_v_rect);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_rect);
      __Pyx_INCREF(__pyx_v_start_angle);
      __Pyx_GIVEREF(__pyx_v_start_angle);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_start_angle);
      __Pyx_INCREF(__pyx_v_stop_angle);
      __Pyx_GIVEREF(__pyx_v_stop_angle);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_stop_angle);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 5+__pyx_t_8, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1471, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1478
 *                             width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1478, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1478, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1478, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1478, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1468
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.arc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1481
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_13line(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_13line = {"line", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_13line, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_13line(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_start_pos = 0;
  PyObject *__pyx_v_end_pos = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("line (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_start_pos,&__pyx_n_s_end_pos,&__pyx_n_s_width,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)__pyx_int_1));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 1); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_start_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 2); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 3); __PYX_ERR(0, 1481, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "line") < 0)) __PYX_ERR(0, 1481, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_start_pos = values[2];
    __pyx_v_end_pos = values[3];
    __pyx_v_width = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1481, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_12line(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_start_pos, __pyx_v_end_pos, __pyx_v_width);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_12line(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_start_pos, PyObject *__pyx_v_end_pos, PyObject *__pyx_v_width) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("line", 0);

  /* "renpy/display/render.pyx":1482
 * 
 *     def line(self, color, start_pos, end_pos, width=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1483
 *     def line(self, color, start_pos, end_pos, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.line(self.surf,
 *                              renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1483, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1483, __pyx_L4_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, 1483, __pyx_L4_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, 1483, __pyx_L4_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/display/render.pyx":1484
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,             # <<<<<<<<<<<<<<
 *                              renpy.easy.color(color),
 *                              start_pos,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1484, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1484, __pyx_L4_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_line); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1484, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1484, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1485
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,
 *                              renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                              start_pos,
 *                              end_pos,
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1485, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1485, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1485, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1485, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1485, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1488
 *                              start_pos,
 *                              end_pos,
 *                              width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_start_pos, __pyx_v_end_pos, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1484, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_start_pos, __pyx_v_end_pos, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1484, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1484, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_start_pos);
      __Pyx_GIVEREF(__pyx_v_start_pos);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_start_pos);
      __Pyx_INCREF(__pyx_v_end_pos);
      __Pyx_GIVEREF(__pyx_v_end_pos);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_end_pos);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1484, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1490
 *                              width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def lines(self, color, closed, pointlist, width=1):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1490, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1490, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1490, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1490, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1481
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1492
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_15lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_15lines = {"lines", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_15lines, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_15lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_closed = 0;
  PyObject *__pyx_v_pointlist = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lines (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_closed,&__pyx_n_s_pointlist,&__pyx_n_s_width,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)__pyx_int_1));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 1); __PYX_ERR(0, 1492, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_closed)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 2); __PYX_ERR(0, 1492, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pointlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 3); __PYX_ERR(0, 1492, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lines") < 0)) __PYX_ERR(0, 1492, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_closed = values[2];
    __pyx_v_pointlist = values[3];
    __pyx_v_width = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1492, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.lines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_14lines(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_closed, __pyx_v_pointlist, __pyx_v_width);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_14lines(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_closed, PyObject *__pyx_v_pointlist, PyObject *__pyx_v_width) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("lines", 0);

  /* "renpy/display/render.pyx":1493
 * 
 *     def lines(self, color, closed, pointlist, width=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1494
 *     def lines(self, color, closed, pointlist, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.lines(self.surf,
 *                               renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1494, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1494, __pyx_L4_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, 1494, __pyx_L4_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, 1494, __pyx_L4_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/display/render.pyx":1495
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,             # <<<<<<<<<<<<<<
 *                               renpy.easy.color(color),
 *                               closed,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1495, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L4_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_lines); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1495, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1495, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1496
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,
 *                               renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                               closed,
 *                               pointlist,
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1496, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1496, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1496, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1496, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1496, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1499
 *                               closed,
 *                               pointlist,
 *                               width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_closed, __pyx_v_pointlist, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1495, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_closed, __pyx_v_pointlist, __pyx_v_width};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1495, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1495, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_closed);
      __Pyx_GIVEREF(__pyx_v_closed);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_closed);
      __Pyx_INCREF(__pyx_v_pointlist);
      __Pyx_GIVEREF(__pyx_v_pointlist);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_pointlist);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1495, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1501
 *                               width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1501, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1501, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1501, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1501, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1492
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.lines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1503
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_17aaline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_17aaline = {"aaline", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_17aaline, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_17aaline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_startpos = 0;
  PyObject *__pyx_v_endpos = 0;
  PyObject *__pyx_v_blend = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("aaline (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_startpos,&__pyx_n_s_endpos,&__pyx_n_s_blend,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)__pyx_int_1));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 1); __PYX_ERR(0, 1503, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_startpos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 2); __PYX_ERR(0, 1503, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_endpos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 3); __PYX_ERR(0, 1503, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_blend);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "aaline") < 0)) __PYX_ERR(0, 1503, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_startpos = values[2];
    __pyx_v_endpos = values[3];
    __pyx_v_blend = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1503, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.aaline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_16aaline(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_startpos, __pyx_v_endpos, __pyx_v_blend);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_16aaline(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_startpos, PyObject *__pyx_v_endpos, PyObject *__pyx_v_blend) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("aaline", 0);

  /* "renpy/display/render.pyx":1504
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1505
 *     def aaline(self, color, startpos, endpos, blend=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.aaline(self.surf,
 *                                renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1505, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1505, __pyx_L4_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, 1505, __pyx_L4_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, 1505, __pyx_L4_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/display/render.pyx":1506
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,             # <<<<<<<<<<<<<<
 *                                renpy.easy.color(color),
 *                                startpos,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L4_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_aaline); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1506, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1506, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1507
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,
 *                                renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                startpos,
 *                                endpos,
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1507, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1507, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1507, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1507, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1507, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1507, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1507, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1507, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1510
 *                                startpos,
 *                                endpos,
 *                                blend)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_startpos, __pyx_v_endpos, __pyx_v_blend};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_startpos, __pyx_v_endpos, __pyx_v_blend};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1506, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_startpos);
      __Pyx_GIVEREF(__pyx_v_startpos);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_startpos);
      __Pyx_INCREF(__pyx_v_endpos);
      __Pyx_GIVEREF(__pyx_v_endpos);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_endpos);
      __Pyx_INCREF(__pyx_v_blend);
      __Pyx_GIVEREF(__pyx_v_blend);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_blend);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1512
 *                                blend)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1512, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1512, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1512, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1512, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1503
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.aaline", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1514
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_19aalines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_19aalines = {"aalines", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_19aalines, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_19aalines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_closed = 0;
  PyObject *__pyx_v_pointlist = 0;
  PyObject *__pyx_v_blend = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("aalines (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_color,&__pyx_n_s_closed,&__pyx_n_s_pointlist,&__pyx_n_s_blend,0};
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)((PyObject *)__pyx_int_1));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        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_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 1); __PYX_ERR(0, 1514, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_closed)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 2); __PYX_ERR(0, 1514, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pointlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 3); __PYX_ERR(0, 1514, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_blend);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "aalines") < 0)) __PYX_ERR(0, 1514, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 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_self = values[0];
    __pyx_v_color = values[1];
    __pyx_v_closed = values[2];
    __pyx_v_pointlist = values[3];
    __pyx_v_blend = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1514, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Canvas.aalines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_18aalines(__pyx_self, __pyx_v_self, __pyx_v_color, __pyx_v_closed, __pyx_v_pointlist, __pyx_v_blend);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_18aalines(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_color, PyObject *__pyx_v_closed, PyObject *__pyx_v_pointlist, PyObject *__pyx_v_blend) {
  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;
  int __pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  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("aalines", 0);

  /* "renpy/display/render.pyx":1515
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1516
 *     def aalines(self, color, closed, pointlist, blend=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.aalines(self.surf,
 *                                 renpy.easy.color(color),
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1516, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_acquire); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1516, __pyx_L4_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, 1516, __pyx_L4_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, 1516, __pyx_L4_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/display/render.pyx":1517
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 closed,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1517, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_draw); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1517, __pyx_L4_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_aalines); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1517, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1517, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1518
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 closed,
 *                                 pointlist,
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1518, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_easy); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1518, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_color); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1518, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __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_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1518, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1518, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
        PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_color};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1518, __pyx_L4_error)
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1518, __pyx_L4_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_INCREF(__pyx_v_color);
        __Pyx_GIVEREF(__pyx_v_color);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_color);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1518, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1521
 *                                 closed,
 *                                 pointlist,
 *                                 blend)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_closed, __pyx_v_pointlist, __pyx_v_blend};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __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[6] = {__pyx_t_5, __pyx_t_2, __pyx_t_4, __pyx_v_closed, __pyx_v_pointlist, __pyx_v_blend};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L4_error)
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    #endif
    {
      __pyx_t_7 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1517, __pyx_L4_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_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_8, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_8, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_closed);
      __Pyx_GIVEREF(__pyx_v_closed);
      PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_8, __pyx_v_closed);
      __Pyx_INCREF(__pyx_v_pointlist);
      __Pyx_GIVEREF(__pyx_v_pointlist);
      PyTuple_SET_ITEM(__pyx_t_7, 3+__pyx_t_8, __pyx_v_pointlist);
      __Pyx_INCREF(__pyx_v_blend);
      __Pyx_GIVEREF(__pyx_v_blend);
      PyTuple_SET_ITEM(__pyx_t_7, 4+__pyx_t_8, __pyx_v_blend);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1517, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1523
 *                                 blend)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def get_surface(self):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1523, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __pyx_t_8 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename;
      {
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_blit_lock); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1523, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1523, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = NULL;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L7_error)
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L7_error)
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13);
      __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      __pyx_lineno = __pyx_t_8; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16);
      }
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1514
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

  /* 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_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.display.render.Canvas.aalines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1525
 *             blit_lock.release()
 * 
 *     def get_surface(self):             # <<<<<<<<<<<<<<
 *         return self.surf
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_21get_surface(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_21get_surface = {"get_surface", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Canvas_21get_surface, METH_O, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_6Canvas_21get_surface(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_surface (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Canvas_20get_surface(__pyx_self, ((PyObject *)__pyx_v_self));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_20get_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("get_surface", 0);

  /* "renpy/display/render.pyx":1526
 * 
 *     def get_surface(self):
 *         return self.surf             # <<<<<<<<<<<<<<
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_surf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1526, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1525
 *             blit_lock.release()
 * 
 *     def get_surface(self):             # <<<<<<<<<<<<<<
 *         return self.surf
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Canvas.get_surface", __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_Matrix2D(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x3190674:
 *         from pickle import PickleError as __pyx_PickleError
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_31__pyx_unpickle_Matrix2D(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_31__pyx_unpickle_Matrix2D = {"__pyx_unpickle_Matrix2D", (PyCFunction)__pyx_pw_5renpy_7display_6render_31__pyx_unpickle_Matrix2D, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_31__pyx_unpickle_Matrix2D(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_Matrix2D (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_Matrix2D", 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_Matrix2D", 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_Matrix2D") < 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_Matrix2D", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.__pyx_unpickle_Matrix2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_30__pyx_unpickle_Matrix2D(__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_7display_6render_30__pyx_unpickle_Matrix2D(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_Matrix2D", 0);

  /* "(tree fragment)":2
 * def __pyx_unpickle_Matrix2D(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x3190674:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3190674 = (xdx, xdy, ydx, ydy))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x3190674) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":3
 * def __pyx_unpickle_Matrix2D(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x3190674:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3190674 = (xdx, xdy, ydx, ydy))" % __pyx_checksum)
 *     __pyx_result = Matrix2D.__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 != 0x3190674:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3190674 = (xdx, xdy, ydx, ydy))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Matrix2D.__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_0x31, __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_Matrix2D(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0x3190674:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3190674 = (xdx, xdy, ydx, ydy))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":5
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x3190674 = (xdx, xdy, ydx, ydy))" % __pyx_checksum)
 *     __pyx_result = Matrix2D.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Matrix2D__set_state(<Matrix2D> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5renpy_7display_6render_Matrix2D), __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 0x3190674 = (xdx, xdy, ydx, ydy))" % __pyx_checksum)
 *     __pyx_result = Matrix2D.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Matrix2D__set_state(<Matrix2D> __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 = Matrix2D.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Matrix2D__set_state(<Matrix2D> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __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_7display_6render___pyx_unpickle_Matrix2D__set_state(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__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 0x3190674 = (xdx, xdy, ydx, ydy))" % __pyx_checksum)
 *     __pyx_result = Matrix2D.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Matrix2D__set_state(<Matrix2D> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":8
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Matrix2D__set_state(<Matrix2D> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __pyx_result, tuple __pyx_state):
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]
 */
  __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_Matrix2D(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x3190674:
 *         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.display.render.__pyx_unpickle_Matrix2D", __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_Matrix2D__set_state(<Matrix2D> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_5renpy_7display_6render___pyx_unpickle_Matrix2D__set_state(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Matrix2D__set_state", 0);

  /* "(tree fragment)":10
 *     return __pyx_result
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __pyx_result, tuple __pyx_state):
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[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, 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_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->xdx = __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);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->xdy = __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, 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);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->ydx = __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, 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);
  __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->ydy = __pyx_t_2;

  /* "(tree fragment)":11
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __pyx_result, tuple __pyx_state):
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  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_4 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(2, 11, __pyx_L1_error)
  __pyx_t_5 = ((__pyx_t_4 > 4) != 0);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(2, 11, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_5 != 0);
  __pyx_t_3 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":12
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[4])             # <<<<<<<<<<<<<<
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_update); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 12, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_9) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __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_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 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_8)) {
        PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_7};
        __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL;
        __Pyx_GIVEREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":11
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __pyx_result, tuple __pyx_state):
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[4])
 */
  }

  /* "(tree fragment)":9
 *         __pyx_unpickle_Matrix2D__set_state(<Matrix2D> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]
 *     if len(__pyx_state) > 4 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_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("renpy.display.render.__pyx_unpickle_Matrix2D__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_Render(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xc9b528e:
 *         from pickle import PickleError as __pyx_PickleError
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_33__pyx_unpickle_Render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_33__pyx_unpickle_Render = {"__pyx_unpickle_Render", (PyCFunction)__pyx_pw_5renpy_7display_6render_33__pyx_unpickle_Render, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_33__pyx_unpickle_Render(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_Render (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_Render", 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_Render", 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_Render") < 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_Render", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.__pyx_unpickle_Render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_32__pyx_unpickle_Render(__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_7display_6render_32__pyx_unpickle_Render(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_Render", 0);

  /* "(tree fragment)":2
 * def __pyx_unpickle_Render(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xc9b528e:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xc9b528e) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":3
 * def __pyx_unpickle_Render(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xc9b528e:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 *     __pyx_result = Render.__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 != 0xc9b528e:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))" % __pyx_checksum)             # <<<<<<<<<<<<<<
 *     __pyx_result = Render.__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_0xc9, __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_Render(__pyx_type, long __pyx_checksum, __pyx_state):
 *     if __pyx_checksum != 0xc9b528e:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":5
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 *     __pyx_result = Render.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Render__set_state(<Render> __pyx_result, __pyx_state)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_5renpy_7display_6render_Render), __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 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 *     __pyx_result = Render.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Render__set_state(<Render> __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 = Render.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Render__set_state(<Render> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_Render__set_state(Render __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_7display_6render___pyx_unpickle_Render__set_state(((struct __pyx_obj_5renpy_7display_6render_Render *)__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 0xc9b528e = (alpha, alpha_surface, cache_killed, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, mark, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, render_of, reverse, surface, text_input, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 *     __pyx_result = Render.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_Render__set_state(<Render> __pyx_result, __pyx_state)
 *     return __pyx_result
 */
  }

  /* "(tree fragment)":8
 *     if __pyx_state is not None:
 *         __pyx_unpickle_Render__set_state(<Render> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_Render__set_state(Render __pyx_result, tuple __pyx_state):
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.children = __pyx_state[3]; __pyx_result.depends_on_list = __pyx_state[4]; __pyx_result.draw_func = __pyx_state[5]; __pyx_result.focus_screen = __pyx_state[6]; __pyx_result.focuses = __pyx_state[7]; __pyx_result.forward = __pyx_state[8]; __pyx_result.half_cache = __pyx_state[9]; __pyx_result.height = __pyx_state[10]; __pyx_result.layer_name = __pyx_state[11]; __pyx_result.mark = __pyx_state[12]; __pyx_result.modal = __pyx_state[13]; __pyx_result.nearest = __pyx_state[14]; __pyx_result.opaque = __pyx_state[15]; __pyx_result.operation = __pyx_state[16]; __pyx_result.operation_alpha = __pyx_state[17]; __pyx_result.operation_complete = __pyx_state[18]; __pyx_result.operation_parameter = __pyx_state[19]; __pyx_result.over = __pyx_state[20]; __pyx_result.parents = __pyx_state[21]; __pyx_result.pass_focuses = __pyx_state[22]; __pyx_result.render_of = __pyx_state[23]; __pyx_result.reverse = __pyx_state[24]; __pyx_result.surface = __pyx_state[25]; __pyx_result.text_input = __pyx_state[26]; __pyx_result.visible_children = __pyx_state[27]; __pyx_result.width = __pyx_state[28]; __pyx_result.xclipping = __pyx_state[29]; __pyx_result.yclipping = __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_Render(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0xc9b528e:
 *         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.display.render.__pyx_unpickle_Render", __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_Render__set_state(<Render> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Render__set_state(Render __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.children = __pyx_state[3]; __pyx_result.depends_on_list = __pyx_state[4]; __pyx_result.draw_func = __pyx_state[5]; __pyx_result.focus_screen = __pyx_state[6]; __pyx_result.focuses = __pyx_state[7]; __pyx_result.forward = __pyx_state[8]; __pyx_result.half_cache = __pyx_state[9]; __pyx_result.height = __pyx_state[10]; __pyx_result.layer_name = __pyx_state[11]; __pyx_result.mark = __pyx_state[12]; __pyx_result.modal = __pyx_state[13]; __pyx_result.nearest = __pyx_state[14]; __pyx_result.opaque = __pyx_state[15]; __pyx_result.operation = __pyx_state[16]; __pyx_result.operation_alpha = __pyx_state[17]; __pyx_result.operation_complete = __pyx_state[18]; __pyx_result.operation_parameter = __pyx_state[19]; __pyx_result.over = __pyx_state[20]; __pyx_result.parents = __pyx_state[21]; __pyx_result.pass_focuses = __pyx_state[22]; __pyx_result.render_of = __pyx_state[23]; __pyx_result.reverse = __pyx_state[24]; __pyx_result.surface = __pyx_state[25]; __pyx_result.text_input = __pyx_state[26]; __pyx_result.visible_children = __pyx_state[27]; __pyx_result.width = __pyx_state[28]; __pyx_result.xclipping = __pyx_state[29]; __pyx_result.yclipping = __pyx_state[30]
 *     if len(__pyx_state) > 31 and hasattr(__pyx_result, '__dict__'):
 */

static PyObject *__pyx_f_5renpy_7display_6render___pyx_unpickle_Render__set_state(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_t_3;
  float __pyx_t_4;
  int __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_Render__set_state", 0);

  /* "(tree fragment)":10
 *     return __pyx_result
 * cdef __pyx_unpickle_Render__set_state(Render __pyx_result, tuple __pyx_state):
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.children = __pyx_state[3]; __pyx_result.depends_on_list = __pyx_state[4]; __pyx_result.draw_func = __pyx_state[5]; __pyx_result.focus_screen = __pyx_state[6]; __pyx_result.focuses = __pyx_state[7]; __pyx_result.forward = __pyx_state[8]; __pyx_result.half_cache = __pyx_state[9]; __pyx_result.height = __pyx_state[10]; __pyx_result.layer_name = __pyx_state[11]; __pyx_result.mark = __pyx_state[12]; __pyx_result.modal = __pyx_state[13]; __pyx_result.nearest = __pyx_state[14]; __pyx_result.opaque = __pyx_state[15]; __pyx_result.operation = __pyx_state[16]; __pyx_result.operation_alpha = __pyx_state[17]; __pyx_result.operation_complete = __pyx_state[18]; __pyx_result.operation_parameter = __pyx_state[19]; __pyx_result.over = __pyx_state[20]; __pyx_result.parents = __pyx_state[21]; __pyx_result.pass_focuses = __pyx_state[22]; __pyx_result.render_of = __pyx_state[23]; __pyx_result.reverse = __pyx_state[24]; __pyx_result.surface = __pyx_state[25]; __pyx_result.text_input = __pyx_state[26]; __pyx_result.visible_children = __pyx_state[27]; __pyx_result.width = __pyx_state[28]; __pyx_result.xclipping = __pyx_state[29]; __pyx_result.yclipping = __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_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->alpha = __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);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->alpha_surface);
  __Pyx_DECREF(__pyx_v___pyx_result->alpha_surface);
  __pyx_v___pyx_result->alpha_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, 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);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->cache_killed = __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, 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(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", 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->children);
  __Pyx_DECREF(__pyx_v___pyx_result->children);
  __pyx_v___pyx_result->children = ((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);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", 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->depends_on_list);
  __Pyx_DECREF(__pyx_v___pyx_result->depends_on_list);
  __pyx_v___pyx_result->depends_on_list = ((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, 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_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->draw_func);
  __Pyx_DECREF(__pyx_v___pyx_result->draw_func);
  __pyx_v___pyx_result->draw_func = __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, 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_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->focus_screen);
  __Pyx_DECREF(__pyx_v___pyx_result->focus_screen);
  __pyx_v___pyx_result->focus_screen = __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, 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);
  if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", 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->focuses);
  __Pyx_DECREF(__pyx_v___pyx_result->focuses);
  __pyx_v___pyx_result->focuses = ((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, 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);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->forward);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->forward));
  __pyx_v___pyx_result->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__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, 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->half_cache);
  __Pyx_DECREF(__pyx_v___pyx_result->half_cache);
  __pyx_v___pyx_result->half_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, 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);
  __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->height = __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, 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);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->layer_name);
  __Pyx_DECREF(__pyx_v___pyx_result->layer_name);
  __pyx_v___pyx_result->layer_name = __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);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->mark = __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, 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_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->modal = __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, 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_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->nearest);
  __Pyx_DECREF(__pyx_v___pyx_result->nearest);
  __pyx_v___pyx_result->nearest = __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, 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_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->opaque = __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, 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);
  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->operation = __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, 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_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->operation_alpha = __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, 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_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->operation_complete = __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, 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->operation_parameter);
  __Pyx_DECREF(__pyx_v___pyx_result->operation_parameter);
  __pyx_v___pyx_result->operation_parameter = __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_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->over = __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, 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(PySet_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "set", 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->parents);
  __Pyx_DECREF(__pyx_v___pyx_result->parents);
  __pyx_v___pyx_result->parents = ((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(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", 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->pass_focuses);
  __Pyx_DECREF(__pyx_v___pyx_result->pass_focuses);
  __pyx_v___pyx_result->pass_focuses = ((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->render_of);
  __Pyx_DECREF(__pyx_v___pyx_result->render_of);
  __pyx_v___pyx_result->render_of = __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);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->reverse);
  __Pyx_DECREF(((PyObject *)__pyx_v___pyx_result->reverse));
  __pyx_v___pyx_result->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__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, 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->surface);
  __Pyx_DECREF(__pyx_v___pyx_result->surface);
  __pyx_v___pyx_result->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, 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_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->text_input = __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, 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(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", 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->visible_children);
  __Pyx_DECREF(__pyx_v___pyx_result->visible_children);
  __pyx_v___pyx_result->visible_children = ((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, 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);
  __pyx_t_4 = __pyx_PyFloat_AsFloat(__pyx_t_1); if (unlikely((__pyx_t_4 == (float)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->width = __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, 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);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->xclipping = __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, 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_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 10, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->yclipping = __pyx_t_3;

  /* "(tree fragment)":11
 * cdef __pyx_unpickle_Render__set_state(Render __pyx_result, tuple __pyx_state):
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.children = __pyx_state[3]; __pyx_result.depends_on_list = __pyx_state[4]; __pyx_result.draw_func = __pyx_state[5]; __pyx_result.focus_screen = __pyx_state[6]; __pyx_result.focuses = __pyx_state[7]; __pyx_result.forward = __pyx_state[8]; __pyx_result.half_cache = __pyx_state[9]; __pyx_result.height = __pyx_state[10]; __pyx_result.layer_name = __pyx_state[11]; __pyx_result.mark = __pyx_state[12]; __pyx_result.modal = __pyx_state[13]; __pyx_result.nearest = __pyx_state[14]; __pyx_result.opaque = __pyx_state[15]; __pyx_result.operation = __pyx_state[16]; __pyx_result.operation_alpha = __pyx_state[17]; __pyx_result.operation_complete = __pyx_state[18]; __pyx_result.operation_parameter = __pyx_state[19]; __pyx_result.over = __pyx_state[20]; __pyx_result.parents = __pyx_state[21]; __pyx_result.pass_focuses = __pyx_state[22]; __pyx_result.render_of = __pyx_state[23]; __pyx_result.reverse = __pyx_state[24]; __pyx_result.surface = __pyx_state[25]; __pyx_result.text_input = __pyx_state[26]; __pyx_result.visible_children = __pyx_state[27]; __pyx_result.width = __pyx_state[28]; __pyx_result.xclipping = __pyx_state[29]; __pyx_result.yclipping = __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_3 = __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_3 = __pyx_t_8;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":12
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.children = __pyx_state[3]; __pyx_result.depends_on_list = __pyx_state[4]; __pyx_result.draw_func = __pyx_state[5]; __pyx_result.focus_screen = __pyx_state[6]; __pyx_result.focuses = __pyx_state[7]; __pyx_result.forward = __pyx_state[8]; __pyx_result.half_cache = __pyx_state[9]; __pyx_result.height = __pyx_state[10]; __pyx_result.layer_name = __pyx_state[11]; __pyx_result.mark = __pyx_state[12]; __pyx_result.modal = __pyx_state[13]; __pyx_result.nearest = __pyx_state[14]; __pyx_result.opaque = __pyx_state[15]; __pyx_result.operation = __pyx_state[16]; __pyx_result.operation_alpha = __pyx_state[17]; __pyx_result.operation_complete = __pyx_state[18]; __pyx_result.operation_parameter = __pyx_state[19]; __pyx_result.over = __pyx_state[20]; __pyx_result.parents = __pyx_state[21]; __pyx_result.pass_focuses = __pyx_state[22]; __pyx_result.render_of = __pyx_state[23]; __pyx_result.reverse = __pyx_state[24]; __pyx_result.surface = __pyx_state[25]; __pyx_result.text_input = __pyx_state[26]; __pyx_result.visible_children = __pyx_state[27]; __pyx_result.width = __pyx_state[28]; __pyx_result.xclipping = __pyx_state[29]; __pyx_result.yclipping = __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_Render__set_state(Render __pyx_result, tuple __pyx_state):
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.children = __pyx_state[3]; __pyx_result.depends_on_list = __pyx_state[4]; __pyx_result.draw_func = __pyx_state[5]; __pyx_result.focus_screen = __pyx_state[6]; __pyx_result.focuses = __pyx_state[7]; __pyx_result.forward = __pyx_state[8]; __pyx_result.half_cache = __pyx_state[9]; __pyx_result.height = __pyx_state[10]; __pyx_result.layer_name = __pyx_state[11]; __pyx_result.mark = __pyx_state[12]; __pyx_result.modal = __pyx_state[13]; __pyx_result.nearest = __pyx_state[14]; __pyx_result.opaque = __pyx_state[15]; __pyx_result.operation = __pyx_state[16]; __pyx_result.operation_alpha = __pyx_state[17]; __pyx_result.operation_complete = __pyx_state[18]; __pyx_result.operation_parameter = __pyx_state[19]; __pyx_result.over = __pyx_state[20]; __pyx_result.parents = __pyx_state[21]; __pyx_result.pass_focuses = __pyx_state[22]; __pyx_result.render_of = __pyx_state[23]; __pyx_result.reverse = __pyx_state[24]; __pyx_result.surface = __pyx_state[25]; __pyx_result.text_input = __pyx_state[26]; __pyx_result.visible_children = __pyx_state[27]; __pyx_result.width = __pyx_state[28]; __pyx_result.xclipping = __pyx_state[29]; __pyx_result.yclipping = __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_Render__set_state(<Render> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Render__set_state(Render __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.children = __pyx_state[3]; __pyx_result.depends_on_list = __pyx_state[4]; __pyx_result.draw_func = __pyx_state[5]; __pyx_result.focus_screen = __pyx_state[6]; __pyx_result.focuses = __pyx_state[7]; __pyx_result.forward = __pyx_state[8]; __pyx_result.half_cache = __pyx_state[9]; __pyx_result.height = __pyx_state[10]; __pyx_result.layer_name = __pyx_state[11]; __pyx_result.mark = __pyx_state[12]; __pyx_result.modal = __pyx_state[13]; __pyx_result.nearest = __pyx_state[14]; __pyx_result.opaque = __pyx_state[15]; __pyx_result.operation = __pyx_state[16]; __pyx_result.operation_alpha = __pyx_state[17]; __pyx_result.operation_complete = __pyx_state[18]; __pyx_result.operation_parameter = __pyx_state[19]; __pyx_result.over = __pyx_state[20]; __pyx_result.parents = __pyx_state[21]; __pyx_result.pass_focuses = __pyx_state[22]; __pyx_result.render_of = __pyx_state[23]; __pyx_result.reverse = __pyx_state[24]; __pyx_result.surface = __pyx_state[25]; __pyx_result.text_input = __pyx_state[26]; __pyx_result.visible_children = __pyx_state[27]; __pyx_result.width = __pyx_state[28]; __pyx_result.xclipping = __pyx_state[29]; __pyx_result.yclipping = __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.display.render.__pyx_unpickle_Render__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D __pyx_vtable_5renpy_7display_6render_Matrix2D;

static PyObject *__pyx_tp_new_5renpy_7display_6render_Matrix2D(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *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_7display_6render_Matrix2D *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_7display_6render_Matrix2D;
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6render_Matrix2D(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 PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_xdx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_8Matrix2D_3xdx_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdx(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_8Matrix2D_3xdx_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_xdy(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_8Matrix2D_3xdy_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdy(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_8Matrix2D_3xdy_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_ydx(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_8Matrix2D_3ydx_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydx(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_8Matrix2D_3ydx_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_ydy(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_8Matrix2D_3ydy_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydy(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_8Matrix2D_3ydy_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5renpy_7display_6render_Matrix2D[] = {
  {"__getstate__", (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_1__getstate__, METH_NOARGS, 0},
  {"__setstate__", (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_3__setstate__, METH_O, 0},
  {"transform", (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_7transform, METH_VARARGS|METH_KEYWORDS, 0},
  {"is_unit_aligned", (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_15is_unit_aligned, METH_NOARGS, __pyx_doc_5renpy_7display_6render_8Matrix2D_14is_unit_aligned},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_17__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_5renpy_7display_6render_8Matrix2D_19__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5renpy_7display_6render_Matrix2D[] = {
  {(char *)"xdx", __pyx_getprop_5renpy_7display_6render_8Matrix2D_xdx, __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdx, (char *)0, 0},
  {(char *)"xdy", __pyx_getprop_5renpy_7display_6render_8Matrix2D_xdy, __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdy, (char *)0, 0},
  {(char *)"ydx", __pyx_getprop_5renpy_7display_6render_8Matrix2D_ydx, __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydx, (char *)0, 0},
  {(char *)"ydy", __pyx_getprop_5renpy_7display_6render_8Matrix2D_ydy, __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydy, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Matrix2D = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  __pyx_pw_5renpy_7display_6render_8Matrix2D_9__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3 || (CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03050000)
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_matrix_multiply*/
  #endif
  #if PY_VERSION_HEX >= 0x03050000
  0, /*nb_inplace_matrix_multiply*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_7display_6render_Matrix2D = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.display.render.Matrix2D", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6render_Matrix2D), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_6render_Matrix2D, /*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
  __pyx_pw_5renpy_7display_6render_8Matrix2D_11__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Matrix2D, /*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*/
  "\n    This represents a 2d matrix that can be used to transform\n    points and things like that.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  __pyx_pw_5renpy_7display_6render_8Matrix2D_13__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_7display_6render_Matrix2D, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5renpy_7display_6render_Matrix2D, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5renpy_7display_6render_8Matrix2D_5__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_7display_6render_Matrix2D, /*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_7display_6render_Render __pyx_vtable_5renpy_7display_6render_Render;

static PyObject *__pyx_tp_new_5renpy_7display_6render_Render(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_7display_6render_Render *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_7display_6render_Render *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_7display_6render_Render;
  p->layer_name = Py_None; Py_INCREF(Py_None);
  p->children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->parents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->depends_on_list = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->operation_parameter = Py_None; Py_INCREF(Py_None);
  p->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  p->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  p->nearest = Py_None; Py_INCREF(Py_None);
  p->focuses = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->pass_focuses = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->focus_screen = Py_None; Py_INCREF(Py_None);
  p->draw_func = Py_None; Py_INCREF(Py_None);
  p->render_of = Py_None; Py_INCREF(Py_None);
  p->visible_children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->surface = Py_None; Py_INCREF(Py_None);
  p->alpha_surface = Py_None; Py_INCREF(Py_None);
  p->half_cache = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6render_Render(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6render_Render *p = (struct __pyx_obj_5renpy_7display_6render_Render *)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->layer_name);
  Py_CLEAR(p->children);
  Py_CLEAR(p->parents);
  Py_CLEAR(p->depends_on_list);
  Py_CLEAR(p->operation_parameter);
  Py_CLEAR(p->forward);
  Py_CLEAR(p->reverse);
  Py_CLEAR(p->nearest);
  Py_CLEAR(p->focuses);
  Py_CLEAR(p->pass_focuses);
  Py_CLEAR(p->focus_screen);
  Py_CLEAR(p->draw_func);
  Py_CLEAR(p->render_of);
  Py_CLEAR(p->visible_children);
  Py_CLEAR(p->surface);
  Py_CLEAR(p->alpha_surface);
  Py_CLEAR(p->half_cache);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_7display_6render_Render(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_7display_6render_Render *p = (struct __pyx_obj_5renpy_7display_6render_Render *)o;
  if (p->layer_name) {
    e = (*v)(p->layer_name, a); if (e) return e;
  }
  if (p->children) {
    e = (*v)(p->children, a); if (e) return e;
  }
  if (p->parents) {
    e = (*v)(p->parents, a); if (e) return e;
  }
  if (p->depends_on_list) {
    e = (*v)(p->depends_on_list, a); if (e) return e;
  }
  if (p->operation_parameter) {
    e = (*v)(p->operation_parameter, a); if (e) return e;
  }
  if (p->forward) {
    e = (*v)(((PyObject *)p->forward), a); if (e) return e;
  }
  if (p->reverse) {
    e = (*v)(((PyObject *)p->reverse), a); if (e) return e;
  }
  if (p->nearest) {
    e = (*v)(p->nearest, a); if (e) return e;
  }
  if (p->focuses) {
    e = (*v)(p->focuses, a); if (e) return e;
  }
  if (p->pass_focuses) {
    e = (*v)(p->pass_focuses, a); if (e) return e;
  }
  if (p->focus_screen) {
    e = (*v)(p->focus_screen, a); if (e) return e;
  }
  if (p->draw_func) {
    e = (*v)(p->draw_func, a); if (e) return e;
  }
  if (p->render_of) {
    e = (*v)(p->render_of, a); if (e) return e;
  }
  if (p->visible_children) {
    e = (*v)(p->visible_children, a); if (e) return e;
  }
  if (p->surface) {
    e = (*v)(p->surface, a); if (e) return e;
  }
  if (p->alpha_surface) {
    e = (*v)(p->alpha_surface, a); if (e) return e;
  }
  if (p->half_cache) {
    e = (*v)(p->half_cache, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_7display_6render_Render(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5renpy_7display_6render_Render *p = (struct __pyx_obj_5renpy_7display_6render_Render *)o;
  tmp = ((PyObject*)p->layer_name);
  p->layer_name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->children);
  p->children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->parents);
  p->parents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->depends_on_list);
  p->depends_on_list = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->operation_parameter);
  p->operation_parameter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->forward);
  p->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->reverse);
  p->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->nearest);
  p->nearest = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->focuses);
  p->focuses = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->pass_focuses);
  p->pass_focuses = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->focus_screen);
  p->focus_screen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->draw_func);
  p->draw_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->render_of);
  p->render_of = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->visible_children);
  p->visible_children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->surface);
  p->surface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->alpha_surface);
  p->alpha_surface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->half_cache);
  p->half_cache = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_mark(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_4mark_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_mark(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_4mark_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_cache_killed(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_12cache_killed_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_cache_killed(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_12cache_killed_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_width(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_5width_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_width(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_5width_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_height(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_6height_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_height(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_6height_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_layer_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_10layer_name_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_layer_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_10layer_name_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_10layer_name_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_children(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_8children_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_8children_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_8children_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_parents(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_7parents_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_parents(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_7parents_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_7parents_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_depends_on_list(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_depends_on_list(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_15depends_on_list_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_9operation_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_9operation_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation_complete(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_18operation_complete_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation_complete(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_18operation_complete_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation_alpha(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_15operation_alpha_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation_alpha(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_15operation_alpha_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation_parameter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation_parameter(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_19operation_parameter_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_forward(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_7forward_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_forward(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_7forward_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_7forward_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_reverse(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_7reverse_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_reverse(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_7reverse_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_7reverse_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_alpha(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_5alpha_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_alpha(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_5alpha_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_over(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_4over_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_over(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_4over_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_nearest(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_7nearest_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_nearest(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_7nearest_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_7nearest_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_focuses(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_7focuses_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_focuses(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_7focuses_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_7focuses_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_pass_focuses(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_pass_focuses(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_12pass_focuses_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_focus_screen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_12focus_screen_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_focus_screen(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_12focus_screen_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_12focus_screen_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_draw_func(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_9draw_func_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_draw_func(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_9draw_func_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_9draw_func_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_render_of(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_9render_of_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_render_of(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_9render_of_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_9render_of_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_opaque(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_6opaque_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_opaque(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_6opaque_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_visible_children(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_16visible_children_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_visible_children(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_16visible_children_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_16visible_children_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_xclipping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_9xclipping_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_xclipping(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_9xclipping_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_yclipping(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_9yclipping_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_yclipping(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_9yclipping_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_surface(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_7surface_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_surface(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_7surface_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_7surface_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_alpha_surface(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_13alpha_surface_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_alpha_surface(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_13alpha_surface_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_13alpha_surface_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_half_cache(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_10half_cache_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_half_cache(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_10half_cache_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_10half_cache_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_modal(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_5modal_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_modal(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_5modal_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_text_input(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_10text_input_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_text_input(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_10text_input_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5renpy_7display_6render_Render[] = {
  {"__getstate__", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_5__getstate__, METH_NOARGS, 0},
  {"__setstate__", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_7__setstate__, METH_O, 0},
  {"blit", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_9blit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_8blit},
  {"subpixel_blit", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_11subpixel_blit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_10subpixel_blit},
  {"absolute_blit", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_13absolute_blit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_12absolute_blit},
  {"get_size", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_15get_size, METH_NOARGS, __pyx_doc_5renpy_7display_6render_6Render_14get_size},
  {"render_to_texture", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_17render_to_texture, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_16render_to_texture},
  {"subsurface", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_19subsurface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_18subsurface},
  {"depends_on", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_21depends_on, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_20depends_on},
  {"kill_cache", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_23kill_cache, METH_NOARGS, __pyx_doc_5renpy_7display_6render_6Render_22kill_cache},
  {"kill", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_25kill, METH_NOARGS, __pyx_doc_5renpy_7display_6render_6Render_24kill},
  {"add_focus", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_27add_focus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_26add_focus},
  {"take_focuses", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_29take_focuses, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_28take_focuses},
  {"focus_at_point", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_31focus_at_point, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_30focus_at_point},
  {"main_displayables_at_point", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_33main_displayables_at_point, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_32main_displayables_at_point},
  {"is_opaque", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_35is_opaque, METH_NOARGS, __pyx_doc_5renpy_7display_6render_6Render_34is_opaque},
  {"is_pixel_opaque", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_37is_pixel_opaque, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_36is_pixel_opaque},
  {"fill", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_39fill, METH_O, __pyx_doc_5renpy_7display_6render_6Render_38fill},
  {"canvas", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_41canvas, METH_NOARGS, __pyx_doc_5renpy_7display_6render_6Render_40canvas},
  {"screen_rect", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_43screen_rect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_42screen_rect},
  {"place", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_45place, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_44place},
  {"zoom", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_47zoom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_46zoom},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_49__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_51__setstate_cython__, METH_O, 0},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5renpy_7display_6render_Render[] = {
  {(char *)"mark", __pyx_getprop_5renpy_7display_6render_6Render_mark, __pyx_setprop_5renpy_7display_6render_6Render_mark, (char *)0, 0},
  {(char *)"cache_killed", __pyx_getprop_5renpy_7display_6render_6Render_cache_killed, __pyx_setprop_5renpy_7display_6render_6Render_cache_killed, (char *)0, 0},
  {(char *)"width", __pyx_getprop_5renpy_7display_6render_6Render_width, __pyx_setprop_5renpy_7display_6render_6Render_width, (char *)0, 0},
  {(char *)"height", __pyx_getprop_5renpy_7display_6render_6Render_height, __pyx_setprop_5renpy_7display_6render_6Render_height, (char *)0, 0},
  {(char *)"layer_name", __pyx_getprop_5renpy_7display_6render_6Render_layer_name, __pyx_setprop_5renpy_7display_6render_6Render_layer_name, (char *)0, 0},
  {(char *)"children", __pyx_getprop_5renpy_7display_6render_6Render_children, __pyx_setprop_5renpy_7display_6render_6Render_children, (char *)0, 0},
  {(char *)"parents", __pyx_getprop_5renpy_7display_6render_6Render_parents, __pyx_setprop_5renpy_7display_6render_6Render_parents, (char *)0, 0},
  {(char *)"depends_on_list", __pyx_getprop_5renpy_7display_6render_6Render_depends_on_list, __pyx_setprop_5renpy_7display_6render_6Render_depends_on_list, (char *)0, 0},
  {(char *)"operation", __pyx_getprop_5renpy_7display_6render_6Render_operation, __pyx_setprop_5renpy_7display_6render_6Render_operation, (char *)0, 0},
  {(char *)"operation_complete", __pyx_getprop_5renpy_7display_6render_6Render_operation_complete, __pyx_setprop_5renpy_7display_6render_6Render_operation_complete, (char *)0, 0},
  {(char *)"operation_alpha", __pyx_getprop_5renpy_7display_6render_6Render_operation_alpha, __pyx_setprop_5renpy_7display_6render_6Render_operation_alpha, (char *)0, 0},
  {(char *)"operation_parameter", __pyx_getprop_5renpy_7display_6render_6Render_operation_parameter, __pyx_setprop_5renpy_7display_6render_6Render_operation_parameter, (char *)0, 0},
  {(char *)"forward", __pyx_getprop_5renpy_7display_6render_6Render_forward, __pyx_setprop_5renpy_7display_6render_6Render_forward, (char *)0, 0},
  {(char *)"reverse", __pyx_getprop_5renpy_7display_6render_6Render_reverse, __pyx_setprop_5renpy_7display_6render_6Render_reverse, (char *)0, 0},
  {(char *)"alpha", __pyx_getprop_5renpy_7display_6render_6Render_alpha, __pyx_setprop_5renpy_7display_6render_6Render_alpha, (char *)0, 0},
  {(char *)"over", __pyx_getprop_5renpy_7display_6render_6Render_over, __pyx_setprop_5renpy_7display_6render_6Render_over, (char *)0, 0},
  {(char *)"nearest", __pyx_getprop_5renpy_7display_6render_6Render_nearest, __pyx_setprop_5renpy_7display_6render_6Render_nearest, (char *)0, 0},
  {(char *)"focuses", __pyx_getprop_5renpy_7display_6render_6Render_focuses, __pyx_setprop_5renpy_7display_6render_6Render_focuses, (char *)0, 0},
  {(char *)"pass_focuses", __pyx_getprop_5renpy_7display_6render_6Render_pass_focuses, __pyx_setprop_5renpy_7display_6render_6Render_pass_focuses, (char *)0, 0},
  {(char *)"focus_screen", __pyx_getprop_5renpy_7display_6render_6Render_focus_screen, __pyx_setprop_5renpy_7display_6render_6Render_focus_screen, (char *)0, 0},
  {(char *)"draw_func", __pyx_getprop_5renpy_7display_6render_6Render_draw_func, __pyx_setprop_5renpy_7display_6render_6Render_draw_func, (char *)0, 0},
  {(char *)"render_of", __pyx_getprop_5renpy_7display_6render_6Render_render_of, __pyx_setprop_5renpy_7display_6render_6Render_render_of, (char *)0, 0},
  {(char *)"opaque", __pyx_getprop_5renpy_7display_6render_6Render_opaque, __pyx_setprop_5renpy_7display_6render_6Render_opaque, (char *)0, 0},
  {(char *)"visible_children", __pyx_getprop_5renpy_7display_6render_6Render_visible_children, __pyx_setprop_5renpy_7display_6render_6Render_visible_children, (char *)0, 0},
  {(char *)"xclipping", __pyx_getprop_5renpy_7display_6render_6Render_xclipping, __pyx_setprop_5renpy_7display_6render_6Render_xclipping, (char *)0, 0},
  {(char *)"yclipping", __pyx_getprop_5renpy_7display_6render_6Render_yclipping, __pyx_setprop_5renpy_7display_6render_6Render_yclipping, (char *)0, 0},
  {(char *)"surface", __pyx_getprop_5renpy_7display_6render_6Render_surface, __pyx_setprop_5renpy_7display_6render_6Render_surface, (char *)0, 0},
  {(char *)"alpha_surface", __pyx_getprop_5renpy_7display_6render_6Render_alpha_surface, __pyx_setprop_5renpy_7display_6render_6Render_alpha_surface, (char *)0, 0},
  {(char *)"half_cache", __pyx_getprop_5renpy_7display_6render_6Render_half_cache, __pyx_setprop_5renpy_7display_6render_6Render_half_cache, (char *)0, 0},
  {(char *)"modal", __pyx_getprop_5renpy_7display_6render_6Render_modal, __pyx_setprop_5renpy_7display_6render_6Render_modal, (char *)0, 0},
  {(char *)"text_input", __pyx_getprop_5renpy_7display_6render_6Render_text_input, __pyx_setprop_5renpy_7display_6render_6Render_text_input, (char *)0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_7display_6render_Render = {
  PyVarObject_HEAD_INIT(0, 0)
  "renpy.display.render.Render", /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6render_Render), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_6render_Render, /*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
  __pyx_pw_5renpy_7display_6render_6Render_3__repr__, /*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_7display_6render_Render, /*tp_traverse*/
  __pyx_tp_clear_5renpy_7display_6render_Render, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_7display_6render_Render, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5renpy_7display_6render_Render, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5renpy_7display_6render_6Render_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_7display_6render_Render, /*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[] = {
  {"render", (PyCFunction)__pyx_pw_5renpy_7display_6render_9render, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_8render},
  {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_render(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_render},
  {0, NULL}
};
#endif

static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    "render",
    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_n_s_BLIT, __pyx_k_BLIT, sizeof(__pyx_k_BLIT), 0, 0, 1, 1},
  {&__pyx_kp_s_Blitting_to_self, __pyx_k_Blitting_to_self, sizeof(__pyx_k_Blitting_to_self), 0, 0, 1, 0},
  {&__pyx_kp_s_Can_t_pickle_a_Render, __pyx_k_Can_t_pickle_a_Render, sizeof(__pyx_k_Can_t_pickle_a_Render), 0, 0, 1, 0},
  {&__pyx_n_s_Canvas, __pyx_k_Canvas, sizeof(__pyx_k_Canvas), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas___init, __pyx_k_Canvas___init, sizeof(__pyx_k_Canvas___init), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_aaline, __pyx_k_Canvas_aaline, sizeof(__pyx_k_Canvas_aaline), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_aalines, __pyx_k_Canvas_aalines, sizeof(__pyx_k_Canvas_aalines), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_arc, __pyx_k_Canvas_arc, sizeof(__pyx_k_Canvas_arc), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_circle, __pyx_k_Canvas_circle, sizeof(__pyx_k_Canvas_circle), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_ellipse, __pyx_k_Canvas_ellipse, sizeof(__pyx_k_Canvas_ellipse), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_get_surface, __pyx_k_Canvas_get_surface, sizeof(__pyx_k_Canvas_get_surface), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_line, __pyx_k_Canvas_line, sizeof(__pyx_k_Canvas_line), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_lines, __pyx_k_Canvas_lines, sizeof(__pyx_k_Canvas_lines), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_polygon, __pyx_k_Canvas_polygon, sizeof(__pyx_k_Canvas_polygon), 0, 0, 1, 1},
  {&__pyx_n_s_Canvas_rect, __pyx_k_Canvas_rect, sizeof(__pyx_k_Canvas_rect), 0, 0, 1, 1},
  {&__pyx_n_s_Condition, __pyx_k_Condition, sizeof(__pyx_k_Condition), 0, 0, 1, 1},
  {&__pyx_kp_s_Creating_subsurface_failed_child, __pyx_k_Creating_subsurface_failed_child, sizeof(__pyx_k_Creating_subsurface_failed_child), 0, 0, 1, 0},
  {&__pyx_n_s_DISSOLVE, __pyx_k_DISSOLVE, sizeof(__pyx_k_DISSOLVE), 0, 0, 1, 1},
  {&__pyx_kp_s_Displayables_may_not_be_rendered, __pyx_k_Displayables_may_not_be_rendered, sizeof(__pyx_k_Displayables_may_not_be_rendered), 0, 0, 1, 0},
  {&__pyx_n_s_Focus, __pyx_k_Focus, sizeof(__pyx_k_Focus), 0, 0, 1, 1},
  {&__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_kp_s_Incompatible_checksums_s_vs_0x31, __pyx_k_Incompatible_checksums_s_vs_0x31, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x31), 0, 0, 1, 0},
  {&__pyx_kp_s_Incompatible_checksums_s_vs_0xc9, __pyx_k_Incompatible_checksums_s_vs_0xc9, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xc9), 0, 0, 1, 0},
  {&__pyx_kp_s_Matrix2D_xdx_f_xdy_f_ydx_f_ydy_f, __pyx_k_Matrix2D_xdx_f_xdy_f_ydx_f_ydy_f, sizeof(__pyx_k_Matrix2D_xdx_f_xdy_f_ydx_f_ydy_f), 0, 0, 1, 0},
  {&__pyx_n_s_Modal, __pyx_k_Modal, sizeof(__pyx_k_Modal), 0, 0, 1, 1},
  {&__pyx_n_s_NotImplemented, __pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 0, 1, 1},
  {&__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_kp_s_Render_depends_on_itself, __pyx_k_Render_depends_on_itself, sizeof(__pyx_k_Render_depends_on_itself), 0, 0, 1, 0},
  {&__pyx_kp_s_Render_x_of_r, __pyx_k_Render_x_of_r, sizeof(__pyx_k_Render_x_of_r), 0, 0, 1, 0},
  {&__pyx_n_s_ScreenDisplayable, __pyx_k_ScreenDisplayable, sizeof(__pyx_k_ScreenDisplayable), 0, 0, 1, 1},
  {&__pyx_n_s_Sentinel, __pyx_k_Sentinel, sizeof(__pyx_k_Sentinel), 0, 0, 1, 1},
  {&__pyx_n_s_Solid, __pyx_k_Solid, sizeof(__pyx_k_Solid), 0, 0, 1, 1},
  {&__pyx_n_s_aaline, __pyx_k_aaline, sizeof(__pyx_k_aaline), 0, 0, 1, 1},
  {&__pyx_n_s_aalines, __pyx_k_aalines, sizeof(__pyx_k_aalines), 0, 0, 1, 1},
  {&__pyx_n_s_absolute, __pyx_k_absolute, sizeof(__pyx_k_absolute), 0, 0, 1, 1},
  {&__pyx_n_s_absolute_blit, __pyx_k_absolute_blit, sizeof(__pyx_k_absolute_blit), 0, 0, 1, 1},
  {&__pyx_n_s_acquire, __pyx_k_acquire, sizeof(__pyx_k_acquire), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_add_focus, __pyx_k_add_focus, sizeof(__pyx_k_add_focus), 0, 0, 1, 1},
  {&__pyx_n_s_adjust_render_cache_times, __pyx_k_adjust_render_cache_times, sizeof(__pyx_k_adjust_render_cache_times), 0, 0, 1, 1},
  {&__pyx_kp_s_after_clipping, __pyx_k_after_clipping, sizeof(__pyx_k_after_clipping), 0, 0, 1, 0},
  {&__pyx_n_s_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_arc, __pyx_k_arc, sizeof(__pyx_k_arc), 0, 0, 1, 1},
  {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
  {&__pyx_n_s_at, __pyx_k_at, sizeof(__pyx_k_at), 0, 0, 1, 1},
  {&__pyx_n_s_at_base, __pyx_k_at_base, sizeof(__pyx_k_at_base), 0, 0, 1, 1},
  {&__pyx_kp_s_before_clipping, __pyx_k_before_clipping, sizeof(__pyx_k_before_clipping), 0, 0, 1, 0},
  {&__pyx_n_s_blend, __pyx_k_blend, sizeof(__pyx_k_blend), 0, 0, 1, 1},
  {&__pyx_n_s_blit, __pyx_k_blit, sizeof(__pyx_k_blit), 0, 0, 1, 1},
  {&__pyx_n_s_blit_lock, __pyx_k_blit_lock, sizeof(__pyx_k_blit_lock), 0, 0, 1, 1},
  {&__pyx_n_s_cache_killed, __pyx_k_cache_killed, sizeof(__pyx_k_cache_killed), 0, 0, 1, 1},
  {&__pyx_n_s_ceil, __pyx_k_ceil, sizeof(__pyx_k_ceil), 0, 0, 1, 1},
  {&__pyx_n_s_cf, __pyx_k_cf, sizeof(__pyx_k_cf), 0, 0, 1, 1},
  {&__pyx_n_s_check_at_shutdown, __pyx_k_check_at_shutdown, sizeof(__pyx_k_check_at_shutdown), 0, 0, 1, 1},
  {&__pyx_n_s_circle, __pyx_k_circle, sizeof(__pyx_k_circle), 0, 0, 1, 1},
  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 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_clipping, __pyx_k_clipping, sizeof(__pyx_k_clipping), 0, 0, 1, 1},
  {&__pyx_n_s_closed, __pyx_k_closed, sizeof(__pyx_k_closed), 0, 0, 1, 1},
  {&__pyx_n_s_cmaxx, __pyx_k_cmaxx, sizeof(__pyx_k_cmaxx), 0, 0, 1, 1},
  {&__pyx_n_s_cmaxy, __pyx_k_cmaxy, sizeof(__pyx_k_cmaxy), 0, 0, 1, 1},
  {&__pyx_n_s_cminx, __pyx_k_cminx, sizeof(__pyx_k_cminx), 0, 0, 1, 1},
  {&__pyx_n_s_cminy, __pyx_k_cminy, sizeof(__pyx_k_cminy), 0, 0, 1, 1},
  {&__pyx_n_s_collect, __pyx_k_collect, sizeof(__pyx_k_collect), 0, 0, 1, 1},
  {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1},
  {&__pyx_n_s_color, __pyx_k_color, sizeof(__pyx_k_color), 0, 0, 1, 1},
  {&__pyx_n_s_compute_subline, __pyx_k_compute_subline, sizeof(__pyx_k_compute_subline), 0, 0, 1, 1},
  {&__pyx_n_s_config, __pyx_k_config, sizeof(__pyx_k_config), 0, 0, 1, 1},
  {&__pyx_n_s_core, __pyx_k_core, sizeof(__pyx_k_core), 0, 0, 1, 1},
  {&__pyx_n_s_count, __pyx_k_count, sizeof(__pyx_k_count), 0, 0, 1, 1},
  {&__pyx_n_s_crop, __pyx_k_crop, sizeof(__pyx_k_crop), 0, 0, 1, 1},
  {&__pyx_n_s_cw, __pyx_k_cw, sizeof(__pyx_k_cw), 0, 0, 1, 1},
  {&__pyx_n_s_cx0, __pyx_k_cx0, sizeof(__pyx_k_cx0), 0, 0, 1, 1},
  {&__pyx_n_s_cx1, __pyx_k_cx1, sizeof(__pyx_k_cx1), 0, 0, 1, 1},
  {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1},
  {&__pyx_kp_s_d_Renders_are_alive_at_shutdown, __pyx_k_d_Renders_are_alive_at_shutdown, sizeof(__pyx_k_d_Renders_are_alive_at_shutdown), 0, 0, 1, 0},
  {&__pyx_n_s_defaultdict, __pyx_k_defaultdict, sizeof(__pyx_k_defaultdict), 0, 0, 1, 1},
  {&__pyx_n_s_depends_on, __pyx_k_depends_on, sizeof(__pyx_k_depends_on), 0, 0, 1, 1},
  {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1},
  {&__pyx_n_s_developer, __pyx_k_developer, sizeof(__pyx_k_developer), 0, 0, 1, 1},
  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  {&__pyx_n_s_discard, __pyx_k_discard, sizeof(__pyx_k_discard), 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_draw, __pyx_k_draw, sizeof(__pyx_k_draw), 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_easy, __pyx_k_easy, sizeof(__pyx_k_easy), 0, 0, 1, 1},
  {&__pyx_n_s_ellipse, __pyx_k_ellipse, sizeof(__pyx_k_ellipse), 0, 0, 1, 1},
  {&__pyx_n_s_end_pos, __pyx_k_end_pos, sizeof(__pyx_k_end_pos), 0, 0, 1, 1},
  {&__pyx_kp_s_end_render_r, __pyx_k_end_render_r, sizeof(__pyx_k_end_render_r), 0, 0, 1, 0},
  {&__pyx_n_s_endpos, __pyx_k_endpos, sizeof(__pyx_k_endpos), 0, 0, 1, 1},
  {&__pyx_n_s_focus, __pyx_k_focus, sizeof(__pyx_k_focus), 0, 0, 1, 1},
  {&__pyx_n_s_focus_at_point, __pyx_k_focus_at_point, sizeof(__pyx_k_focus_at_point), 0, 0, 1, 1},
  {&__pyx_n_s_focuses, __pyx_k_focuses, sizeof(__pyx_k_focuses), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_frame_time, __pyx_k_frame_time, sizeof(__pyx_k_frame_time), 0, 0, 1, 1},
  {&__pyx_n_s_free_memory, __pyx_k_free_memory, sizeof(__pyx_k_free_memory), 0, 0, 1, 1},
  {&__pyx_n_s_game, __pyx_k_game, sizeof(__pyx_k_game), 0, 0, 1, 1},
  {&__pyx_n_s_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 0, 1, 1},
  {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
  {&__pyx_n_s_get_objects, __pyx_k_get_objects, sizeof(__pyx_k_get_objects), 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_surface, __pyx_k_get_surface, sizeof(__pyx_k_get_surface), 0, 0, 1, 1},
  {&__pyx_n_s_get_time, __pyx_k_get_time, sizeof(__pyx_k_get_time), 0, 0, 1, 1},
  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
  {&__pyx_n_s_height, __pyx_k_height, sizeof(__pyx_k_height), 0, 0, 1, 1},
  {&__pyx_n_s_heighto, __pyx_k_heighto, sizeof(__pyx_k_heighto), 0, 0, 1, 1},
  {&__pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_k_home_tom_ab_renpy_renpy_display, sizeof(__pyx_k_home_tom_ab_renpy_renpy_display), 0, 0, 1, 0},
  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  {&__pyx_n_s_id_d, __pyx_k_id_d, sizeof(__pyx_k_id_d), 0, 0, 1, 1},
  {&__pyx_n_s_imagelike, __pyx_k_imagelike, sizeof(__pyx_k_imagelike), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_interact_time, __pyx_k_interact_time, sizeof(__pyx_k_interact_time), 0, 0, 1, 1},
  {&__pyx_n_s_interface, __pyx_k_interface, sizeof(__pyx_k_interface), 0, 0, 1, 1},
  {&__pyx_n_s_invalidate, __pyx_k_invalidate, sizeof(__pyx_k_invalidate), 0, 0, 1, 1},
  {&__pyx_n_s_invalidated, __pyx_k_invalidated, sizeof(__pyx_k_invalidated), 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, __pyx_k_is_pixel_opaque, sizeof(__pyx_k_is_pixel_opaque), 0, 0, 1, 1},
  {&__pyx_n_s_is_unit_aligned, __pyx_k_is_unit_aligned, sizeof(__pyx_k_is_unit_aligned), 0, 0, 1, 1},
  {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
  {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1},
  {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_kill_cache, __pyx_k_kill_cache, sizeof(__pyx_k_kill_cache), 0, 0, 1, 1},
  {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
  {&__pyx_n_s_layer_name, __pyx_k_layer_name, sizeof(__pyx_k_layer_name), 0, 0, 1, 1},
  {&__pyx_n_s_layers, __pyx_k_layers, sizeof(__pyx_k_layers), 0, 0, 1, 1},
  {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
  {&__pyx_n_s_lines, __pyx_k_lines, sizeof(__pyx_k_lines), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_main_2, __pyx_k_main_2, sizeof(__pyx_k_main_2), 0, 0, 1, 1},
  {&__pyx_n_s_main_displayables_at_point, __pyx_k_main_displayables_at_point, sizeof(__pyx_k_main_displayables_at_point), 0, 0, 1, 1},
  {&__pyx_n_s_mark, __pyx_k_mark, sizeof(__pyx_k_mark), 0, 0, 1, 1},
  {&__pyx_n_s_mark_sweep, __pyx_k_mark_sweep, sizeof(__pyx_k_mark_sweep), 0, 0, 1, 1},
  {&__pyx_n_s_mask, __pyx_k_mask, sizeof(__pyx_k_mask), 0, 0, 1, 1},
  {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_mutated_surface, __pyx_k_mutated_surface, sizeof(__pyx_k_mutated_surface), 0, 0, 1, 1},
  {&__pyx_n_s_mx, __pyx_k_mx, sizeof(__pyx_k_mx), 0, 0, 1, 1},
  {&__pyx_n_s_my, __pyx_k_my, sizeof(__pyx_k_my), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  {&__pyx_n_s_new_redraw_queue, __pyx_k_new_redraw_queue, sizeof(__pyx_k_new_redraw_queue), 0, 0, 1, 1},
  {&__pyx_n_s_new_renders, __pyx_k_new_renders, sizeof(__pyx_k_new_renders), 0, 0, 1, 1},
  {&__pyx_n_s_new_time, __pyx_k_new_time, sizeof(__pyx_k_new_time), 0, 0, 1, 1},
  {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
  {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
  {&__pyx_n_s_objects, __pyx_k_objects, sizeof(__pyx_k_objects), 0, 0, 1, 1},
  {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
  {&__pyx_n_s_old_time, __pyx_k_old_time, sizeof(__pyx_k_old_time), 0, 0, 1, 1},
  {&__pyx_n_s_opaque, __pyx_k_opaque, sizeof(__pyx_k_opaque), 0, 0, 1, 1},
  {&__pyx_n_s_parents, __pyx_k_parents, sizeof(__pyx_k_parents), 0, 0, 1, 1},
  {&__pyx_n_s_per_frame, __pyx_k_per_frame, sizeof(__pyx_k_per_frame), 0, 0, 1, 1},
  {&__pyx_n_s_pgrender, __pyx_k_pgrender, sizeof(__pyx_k_pgrender), 0, 0, 1, 1},
  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  {&__pyx_n_s_place, __pyx_k_place, sizeof(__pyx_k_place), 0, 0, 1, 1},
  {&__pyx_n_s_plog, __pyx_k_plog, sizeof(__pyx_k_plog), 0, 0, 1, 1},
  {&__pyx_n_s_pointlist, __pyx_k_pointlist, sizeof(__pyx_k_pointlist), 0, 0, 1, 1},
  {&__pyx_n_s_polygon, __pyx_k_polygon, sizeof(__pyx_k_polygon), 0, 0, 1, 1},
  {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_process_redraws, __pyx_k_process_redraws, sizeof(__pyx_k_process_redraws), 0, 0, 1, 1},
  {&__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_pygame_surface, __pyx_k_pygame_surface, sizeof(__pyx_k_pygame_surface), 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_Matrix2D, __pyx_k_pyx_unpickle_Matrix2D, sizeof(__pyx_k_pyx_unpickle_Matrix2D), 0, 0, 1, 1},
  {&__pyx_n_s_pyx_unpickle_Render, __pyx_k_pyx_unpickle_Render, sizeof(__pyx_k_pyx_unpickle_Render), 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_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1},
  {&__pyx_kp_s_r_render_must_return_a_Render, __pyx_k_r_render_must_return_a_Render, sizeof(__pyx_k_r_render_must_return_a_Render), 0, 0, 1, 0},
  {&__pyx_n_s_radius, __pyx_k_radius, sizeof(__pyx_k_radius), 0, 0, 1, 1},
  {&__pyx_n_s_rect, __pyx_k_rect, sizeof(__pyx_k_rect), 0, 0, 1, 1},
  {&__pyx_n_s_redraw, __pyx_k_redraw, sizeof(__pyx_k_redraw), 0, 0, 1, 1},
  {&__pyx_n_s_redraw_queue, __pyx_k_redraw_queue, sizeof(__pyx_k_redraw_queue), 0, 0, 1, 1},
  {&__pyx_n_s_redraw_time, __pyx_k_redraw_time, sizeof(__pyx_k_redraw_time), 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_release, __pyx_k_release, sizeof(__pyx_k_release), 0, 0, 1, 1},
  {&__pyx_n_s_render, __pyx_k_render, sizeof(__pyx_k_render), 0, 0, 1, 1},
  {&__pyx_n_s_render_at, __pyx_k_render_at, sizeof(__pyx_k_render_at), 0, 0, 1, 1},
  {&__pyx_n_s_render_cache, __pyx_k_render_cache, sizeof(__pyx_k_render_cache), 0, 0, 1, 1},
  {&__pyx_n_s_render_of, __pyx_k_render_of, sizeof(__pyx_k_render_of), 0, 0, 1, 1},
  {&__pyx_n_s_render_ready, __pyx_k_render_ready, sizeof(__pyx_k_render_ready), 0, 0, 1, 1},
  {&__pyx_n_s_render_screen, __pyx_k_render_screen, sizeof(__pyx_k_render_screen), 0, 0, 1, 1},
  {&__pyx_n_s_render_st, __pyx_k_render_st, sizeof(__pyx_k_render_st), 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_renders, __pyx_k_renders, sizeof(__pyx_k_renders), 0, 0, 1, 1},
  {&__pyx_n_s_renpy, __pyx_k_renpy, sizeof(__pyx_k_renpy), 0, 0, 1, 1},
  {&__pyx_n_s_renpy_display_render, __pyx_k_renpy_display_render, sizeof(__pyx_k_renpy_display_render), 0, 0, 1, 1},
  {&__pyx_n_s_reverse, __pyx_k_reverse, sizeof(__pyx_k_reverse), 0, 0, 1, 1},
  {&__pyx_n_s_root, __pyx_k_root, sizeof(__pyx_k_root), 0, 0, 1, 1},
  {&__pyx_n_s_rv, __pyx_k_rv, sizeof(__pyx_k_rv), 0, 0, 1, 1},
  {&__pyx_n_s_screen, __pyx_k_screen, sizeof(__pyx_k_screen), 0, 0, 1, 1},
  {&__pyx_n_s_screen_render, __pyx_k_screen_render, sizeof(__pyx_k_screen_render), 0, 0, 1, 1},
  {&__pyx_n_s_seen, __pyx_k_seen, sizeof(__pyx_k_seen), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 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_sort, __pyx_k_sort, sizeof(__pyx_k_sort), 0, 0, 1, 1},
  {&__pyx_n_s_source, __pyx_k_source, sizeof(__pyx_k_source), 0, 0, 1, 1},
  {&__pyx_n_s_st, __pyx_k_st, sizeof(__pyx_k_st), 0, 0, 1, 1},
  {&__pyx_n_s_st_base, __pyx_k_st_base, sizeof(__pyx_k_st_base), 0, 0, 1, 1},
  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  {&__pyx_n_s_start_angle, __pyx_k_start_angle, sizeof(__pyx_k_start_angle), 0, 0, 1, 1},
  {&__pyx_n_s_start_pos, __pyx_k_start_pos, sizeof(__pyx_k_start_pos), 0, 0, 1, 1},
  {&__pyx_kp_s_start_render_r, __pyx_k_start_render_r, sizeof(__pyx_k_start_render_r), 0, 0, 1, 0},
  {&__pyx_n_s_startpos, __pyx_k_startpos, sizeof(__pyx_k_startpos), 0, 0, 1, 1},
  {&__pyx_n_s_stop_angle, __pyx_k_stop_angle, sizeof(__pyx_k_stop_angle), 0, 0, 1, 1},
  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  {&__pyx_n_s_style, __pyx_k_style, sizeof(__pyx_k_style), 0, 0, 1, 1},
  {&__pyx_n_s_subpixel_blit, __pyx_k_subpixel_blit, sizeof(__pyx_k_subpixel_blit), 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_surftree, __pyx_k_surftree, sizeof(__pyx_k_surftree), 0, 0, 1, 1},
  {&__pyx_n_s_sw, __pyx_k_sw, sizeof(__pyx_k_sw), 0, 0, 1, 1},
  {&__pyx_n_s_sx, __pyx_k_sx, sizeof(__pyx_k_sx), 0, 0, 1, 1},
  {&__pyx_n_s_sx0, __pyx_k_sx0, sizeof(__pyx_k_sx0), 0, 0, 1, 1},
  {&__pyx_n_s_sx1, __pyx_k_sx1, sizeof(__pyx_k_sx1), 0, 0, 1, 1},
  {&__pyx_n_s_sy, __pyx_k_sy, sizeof(__pyx_k_sy), 0, 0, 1, 1},
  {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1},
  {&__pyx_n_s_take_focuses, __pyx_k_take_focuses, sizeof(__pyx_k_take_focuses), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_threading, __pyx_k_threading, sizeof(__pyx_k_threading), 0, 0, 1, 1},
  {&__pyx_n_s_transform, __pyx_k_transform, sizeof(__pyx_k_transform), 0, 0, 1, 1},
  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1},
  {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
  {&__pyx_n_s_when, __pyx_k_when, sizeof(__pyx_k_when), 0, 0, 1, 1},
  {&__pyx_n_s_width, __pyx_k_width, sizeof(__pyx_k_width), 0, 0, 1, 1},
  {&__pyx_n_s_widtho, __pyx_k_widtho, sizeof(__pyx_k_widtho), 0, 0, 1, 1},
  {&__pyx_n_s_worklist, __pyx_k_worklist, sizeof(__pyx_k_worklist), 0, 0, 1, 1},
  {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1},
  {&__pyx_n_s_xclipping, __pyx_k_xclipping, sizeof(__pyx_k_xclipping), 0, 0, 1, 1},
  {&__pyx_n_s_xdx, __pyx_k_xdx, sizeof(__pyx_k_xdx), 0, 0, 1, 1},
  {&__pyx_n_s_xdy, __pyx_k_xdy, sizeof(__pyx_k_xdy), 0, 0, 1, 1},
  {&__pyx_n_s_xmaximum, __pyx_k_xmaximum, sizeof(__pyx_k_xmaximum), 0, 0, 1, 1},
  {&__pyx_n_s_xzoom, __pyx_k_xzoom, sizeof(__pyx_k_xzoom), 0, 0, 1, 1},
  {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1},
  {&__pyx_n_s_yclipping, __pyx_k_yclipping, sizeof(__pyx_k_yclipping), 0, 0, 1, 1},
  {&__pyx_n_s_ydx, __pyx_k_ydx, sizeof(__pyx_k_ydx), 0, 0, 1, 1},
  {&__pyx_n_s_ydy, __pyx_k_ydy, sizeof(__pyx_k_ydy), 0, 0, 1, 1},
  {&__pyx_n_s_ymaximum, __pyx_k_ymaximum, sizeof(__pyx_k_ymaximum), 0, 0, 1, 1},
  {&__pyx_n_s_yzoom, __pyx_k_yzoom, sizeof(__pyx_k_yzoom), 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, 1418, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 184, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 395, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "renpy/display/render.pyx":180
 *     if not render_is_ready:
 *         if renpy.config.developer:
 *             raise Exception("Displayables may not be rendered during the init phase.")             # <<<<<<<<<<<<<<
 * 
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)
 */
  __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Displayables_may_not_be_rendered); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 180, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple_);
  __Pyx_GIVEREF(__pyx_tuple_);

  /* "renpy/display/render.pyx":247
 * 
 *     if d._clipping:
 *         renpy.plog(4, "before clipping")             # <<<<<<<<<<<<<<
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)
 */
  __pyx_tuple__2 = PyTuple_Pack(2, __pyx_int_4, __pyx_kp_s_before_clipping); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 247, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "renpy/display/render.pyx":250
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)
 *         renpy.plog(4, "after clipping")             # <<<<<<<<<<<<<<
 * 
 *     render_cache_d[wh] = rv
 */
  __pyx_tuple__3 = PyTuple_Pack(2, __pyx_int_4, __pyx_kp_s_after_clipping); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 250, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "renpy/display/render.pyx":695
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")             # <<<<<<<<<<<<<<
 *         else:
 *             return { }
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Can_t_pickle_a_Render); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 695, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "renpy/display/render.pyx":716
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         xo = int(xo)
 */
  __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Blitting_to_self); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 716, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__5);
  __Pyx_GIVEREF(__pyx_tuple__5);

  /* "renpy/display/render.pyx":941
 *                     newchild.width = cw
 *                     newchild.height = ch
 *                     newchild.render_of = child.render_of[:]             # <<<<<<<<<<<<<<
 * 
 *                 else:
 */
  __pyx_slice__6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__6)) __PYX_ERR(0, 941, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__6);
  __Pyx_GIVEREF(__pyx_slice__6);

  /* "renpy/display/render.pyx":1002
 * 
 *         if source is self:
 *             raise Exception("Render depends on itself.")             # <<<<<<<<<<<<<<
 * 
 *         self.depends_on_list.append(source)
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Render_depends_on_itself); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 1002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "renpy/display/render.pyx":1100
 * 
 *         if self.modal:
 *             focuses[:] = [ ]             # <<<<<<<<<<<<<<
 * 
 *         if self.reverse:
 */
  __pyx_slice__8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__8)) __PYX_ERR(0, 1100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__8);
  __Pyx_GIVEREF(__pyx_slice__8);

  /* "renpy/display/render.pyx":1259
 *                 # Ignore the fixed at the root of every screen.
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth - 1)
 *                 rv.extend(cf[1:])             # <<<<<<<<<<<<<<
 *             else:
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth)
 */
  __pyx_slice__9 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__9)) __PYX_ERR(0, 1259, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__9);
  __Pyx_GIVEREF(__pyx_slice__9);

  /* "renpy/display/render.pyx":1324
 *         solid = renpy.display.imagelike.Solid(color)
 *         surf = render(solid, self.width, self.height, 0, 0)
 *         self.blit(surf, (0, 0), focus=False, main=False)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__10 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 1324, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "renpy/display/render.pyx":1336
 *         mutated_surface(surf)
 * 
 *         self.blit(surf, (0, 0))             # <<<<<<<<<<<<<<
 * 
 *         return Canvas(surf)
 */
  __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 1336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "renpy/display/render.pyx":1416
 *             self.forward *= Matrix2D(1.0 / xzoom, 0, 0, 1.0 / yzoom)
 *         else:
 *             self.forward *= Matrix2D(0, 0, 0, 0)             # <<<<<<<<<<<<<<
 * 
 * class Canvas(object):
 */
  __pyx_tuple__12 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 1416, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "renpy/display/render.pyx":59
 * per_frame = False
 * 
 * def adjust_render_cache_times(old_time, new_time):             # <<<<<<<<<<<<<<
 *     """
 *     This adjusts the render cache such that if a render starts at
 */
  __pyx_tuple__13 = PyTuple_Pack(11, __pyx_n_s_old_time, __pyx_n_s_new_time, __pyx_n_s_id_d, __pyx_n_s_renders, __pyx_n_s_k, __pyx_n_s_new_renders, __pyx_n_s_v, __pyx_n_s_w, __pyx_n_s_h, __pyx_n_s_st_base, __pyx_n_s_at_base); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);
  __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_adjust_render_cache_times, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 59, __pyx_L1_error)

  /* "renpy/display/render.pyx":91
 * 
 * 
 * def free_memory():             # <<<<<<<<<<<<<<
 *     """
 *     Frees memory used by the render system.
 */
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_free_memory, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 91, __pyx_L1_error)

  /* "renpy/display/render.pyx":107
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */
  __pyx_tuple__16 = PyTuple_Pack(4, __pyx_n_s_l, __pyx_n_s_count, __pyx_n_s_objects, __pyx_n_s_i); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);
  __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __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_display, __pyx_n_s_check_at_shutdown, 107, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 107, __pyx_L1_error)

  /* "renpy/display/render.pyx":143
 * render_is_ready = 0
 * 
 * def render_ready():             # <<<<<<<<<<<<<<
 *     global render_is_ready
 *     render_is_ready = 1
 */
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_render_ready, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 143, __pyx_L1_error)

  /* "renpy/display/render.pyx":261
 *     return rv
 * 
 * def invalidate(d):             # <<<<<<<<<<<<<<
 *     """
 *     Removes d from the render cache. If we're not in a redraw, triggers
 */
  __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_d, __pyx_n_s_v); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);
  __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_invalidate, 261, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 261, __pyx_L1_error)

  /* "renpy/display/render.pyx":277
 * 
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Called to determine if any redraws are pending. Returns true if we
 */
  __pyx_tuple__21 = PyTuple_Pack(9, __pyx_n_s_now, __pyx_n_s_rv, __pyx_n_s_new_redraw_queue, __pyx_n_s_seen, __pyx_n_s_t, __pyx_n_s_when, __pyx_n_s_d, __pyx_n_s_id_d, __pyx_n_s_v); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);
  __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_process_redraws, 277, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 277, __pyx_L1_error)

  /* "renpy/display/render.pyx":325
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_redraw_time, 325, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 325, __pyx_L1_error)

  /* "renpy/display/render.pyx":336
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */
  __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_d, __pyx_n_s_when); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_redraw, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 336, __pyx_L1_error)

  /* "renpy/display/render.pyx":424
 * 
 * 
 * IDENTITY = Matrix2D(1, 0, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__26 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "renpy/display/render.pyx":428
 * 
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_focuses); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);
  __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_take_focuses, 428, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 428, __pyx_L1_error)

  /* "renpy/display/render.pyx":442
 * # The result of focus_at_point for a modal render. This overrides any
 * # specific focus from below us.
 * Modal = renpy.object.Sentinel("Modal")             # <<<<<<<<<<<<<<
 * 
 * def focus_at_point(x, y):
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_Modal); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "renpy/display/render.pyx":444
 * Modal = renpy.object.Sentinel("Modal")
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */
  __pyx_tuple__30 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_cf, __pyx_n_s_d, __pyx_n_s_arg, __pyx_n_s_screen); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);
  __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_focus_at_point, 444, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 444, __pyx_L1_error)

  /* "renpy/display/render.pyx":461
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_surf); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);
  __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_mutated_surface, 461, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 461, __pyx_L1_error)

  /* "renpy/display/render.pyx":469
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */
  __pyx_tuple__34 = PyTuple_Pack(6, __pyx_n_s_root, __pyx_n_s_width, __pyx_n_s_height, __pyx_n_s_interact_time, __pyx_n_s_st, __pyx_n_s_rv); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_render_screen, 469, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 469, __pyx_L1_error)

  /* "renpy/display/render.pyx":496
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */
  __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_worklist, __pyx_n_s_i, __pyx_n_s_r, __pyx_n_s_j); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);
  __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 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_display, __pyx_n_s_mark_sweep, 496, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 496, __pyx_L1_error)

  /* "renpy/display/render.pyx":536
 *     live_renders = worklist
 * 
 * def compute_subline(sx0, sw, cx0, cw):             # <<<<<<<<<<<<<<
 *     """
 *     Given a source line (start sx0, width sw) and a crop line (cx0, cw),
 */
  __pyx_tuple__38 = PyTuple_Pack(10, __pyx_n_s_sx0, __pyx_n_s_sw, __pyx_n_s_cx0, __pyx_n_s_cw, __pyx_n_s_sx1, __pyx_n_s_cx1, __pyx_n_s_start, __pyx_n_s_offset, __pyx_n_s_crop, __pyx_n_s_width); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);
  __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_compute_subline, 536, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 536, __pyx_L1_error)

  /* "renpy/display/render.pyx":1418
 *             self.forward *= Matrix2D(0, 0, 0, 0)
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "renpy/display/render.pyx":1420
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */
  __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_surf); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_init, 1420, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 1420, __pyx_L1_error)

  /* "renpy/display/render.pyx":1423
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_tuple__43 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_rect, __pyx_n_s_width); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_display, __pyx_n_s_rect, 1423, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __pyx_tuple__45 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "renpy/display/render.pyx":1434
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__46 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_pointlist, __pyx_n_s_width); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_polygon, 1434, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __pyx_tuple__48 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);

  /* "renpy/display/render.pyx":1444
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_pos, __pyx_n_s_radius, __pyx_n_s_width); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);
  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_circle, 1444, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __pyx_tuple__51 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);

  /* "renpy/display/render.pyx":1457
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__52 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_rect, __pyx_n_s_width); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__52);
  __Pyx_GIVEREF(__pyx_tuple__52);
  __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_display, __pyx_n_s_ellipse, 1457, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 1457, __pyx_L1_error)
  __pyx_tuple__54 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);

  /* "renpy/display/render.pyx":1468
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__55 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_rect, __pyx_n_s_start_angle, __pyx_n_s_stop_angle, __pyx_n_s_width); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_arc, 1468, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __pyx_tuple__57 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);

  /* "renpy/display/render.pyx":1481
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__58 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_start_pos, __pyx_n_s_end_pos, __pyx_n_s_width); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__58);
  __Pyx_GIVEREF(__pyx_tuple__58);
  __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(5, 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_home_tom_ab_renpy_renpy_display, __pyx_n_s_line, 1481, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __pyx_tuple__60 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);

  /* "renpy/display/render.pyx":1492
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__61 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_closed, __pyx_n_s_pointlist, __pyx_n_s_width); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(0, 1492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_lines, 1492, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 1492, __pyx_L1_error)
  __pyx_tuple__63 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(0, 1492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);

  /* "renpy/display/render.pyx":1503
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__64 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_startpos, __pyx_n_s_endpos, __pyx_n_s_blend); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__64);
  __Pyx_GIVEREF(__pyx_tuple__64);
  __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_aaline, 1503, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __pyx_tuple__66 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);

  /* "renpy/display/render.pyx":1514
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__67 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_closed, __pyx_n_s_pointlist, __pyx_n_s_blend); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_aalines, 1514, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __pyx_tuple__69 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);

  /* "renpy/display/render.pyx":1525
 *             blit_lock.release()
 * 
 *     def get_surface(self):             # <<<<<<<<<<<<<<
 *         return self.surf
 */
  __pyx_tuple__70 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 1525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__70);
  __Pyx_GIVEREF(__pyx_tuple__70);
  __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_get_surface, 1525, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 1525, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_Matrix2D(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x3190674:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __pyx_tuple__72 = 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__72)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);
  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Matrix2D, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(2, 1, __pyx_L1_error)
  __pyx_tuple__74 = 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__74)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);
  __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Render, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_float_0_0 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_float_0_0)) __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__00001 = PyFloat_FromDouble(.00001); if (unlikely(!__pyx_float__00001)) __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_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __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_51971700 = PyInt_FromLong(51971700L); if (unlikely(!__pyx_int_51971700)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_int_211505806 = PyInt_FromLong(211505806L); if (unlikely(!__pyx_int_211505806)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initrender(void); /*proto*/
PyMODINIT_FUNC initrender(void)
#else
PyMODINIT_FUNC PyInit_render(void); /*proto*/
PyMODINIT_FUNC PyInit_render(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_render(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;
  __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_render(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("render", __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__display__render) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main_2) < 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.display.render")) {
      if (unlikely(PyDict_SetItemString(modules, "renpy.display.render", __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_7display_6render_live_renders = ((PyObject*)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("render", (void (*)(void))__pyx_f_5renpy_7display_6render_render, "PyObject *(PyObject *, PyObject *, PyObject *, double, double, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Type init code ---*/
  __pyx_vtabptr_5renpy_7display_6render_Matrix2D = &__pyx_vtable_5renpy_7display_6render_Matrix2D;
  __pyx_vtable_5renpy_7display_6render_Matrix2D.transform = (PyObject *(*)(struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, int __pyx_skip_dispatch))__pyx_f_5renpy_7display_6render_8Matrix2D_transform;
  __pyx_vtable_5renpy_7display_6render_Matrix2D.is_unit_aligned = (int (*)(struct __pyx_obj_5renpy_7display_6render_Matrix2D *, int __pyx_skip_dispatch))__pyx_f_5renpy_7display_6render_8Matrix2D_is_unit_aligned;
  if (PyType_Ready(&__pyx_type_5renpy_7display_6render_Matrix2D) < 0) __PYX_ERR(0, 354, __pyx_L1_error)
  __pyx_type_5renpy_7display_6render_Matrix2D.tp_print = 0;
  if (__Pyx_SetVtable(__pyx_type_5renpy_7display_6render_Matrix2D.tp_dict, __pyx_vtabptr_5renpy_7display_6render_Matrix2D) < 0) __PYX_ERR(0, 354, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Matrix2D", (PyObject *)&__pyx_type_5renpy_7display_6render_Matrix2D) < 0) __PYX_ERR(0, 354, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5renpy_7display_6render_Matrix2D) < 0) __PYX_ERR(0, 354, __pyx_L1_error)
  __pyx_ptype_5renpy_7display_6render_Matrix2D = &__pyx_type_5renpy_7display_6render_Matrix2D;
  __pyx_vtabptr_5renpy_7display_6render_Render = &__pyx_vtable_5renpy_7display_6render_Render;
  __pyx_vtable_5renpy_7display_6render_Render.blit = (int (*)(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))__pyx_f_5renpy_7display_6render_6Render_blit;
  __pyx_vtable_5renpy_7display_6render_Render.subpixel_blit = (int (*)(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))__pyx_f_5renpy_7display_6render_6Render_subpixel_blit;
  __pyx_vtable_5renpy_7display_6render_Render.absolute_blit = (int (*)(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))__pyx_f_5renpy_7display_6render_6Render_absolute_blit;
  if (PyType_Ready(&__pyx_type_5renpy_7display_6render_Render) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
  __pyx_type_5renpy_7display_6render_Render.tp_print = 0;
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5renpy_7display_6render_Render, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 575, __pyx_L1_error)
    if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) {
      __pyx_wrapperbase_5renpy_7display_6render_6Render___init__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5renpy_7display_6render_6Render___init__.doc = __pyx_doc_5renpy_7display_6render_6Render___init__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5renpy_7display_6render_6Render___init__;
    }
  }
  #endif
  if (__Pyx_SetVtable(__pyx_type_5renpy_7display_6render_Render.tp_dict, __pyx_vtabptr_5renpy_7display_6render_Render) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
  if (PyObject_SetAttrString(__pyx_m, "Render", (PyObject *)&__pyx_type_5renpy_7display_6render_Render) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5renpy_7display_6render_Render) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
  __pyx_ptype_5renpy_7display_6render_Render = &__pyx_type_5renpy_7display_6render_Render;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- 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/display/render.pyx":25
 * from __future__ import print_function
 * 
 * import collections             # <<<<<<<<<<<<<<
 * import pygame_sdl2 as pygame
 * import threading
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_collections, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":26
 * 
 * import collections
 * import pygame_sdl2 as pygame             # <<<<<<<<<<<<<<
 * import threading
 * import renpy
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_pygame_sdl2, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pygame, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":27
 * import collections
 * import pygame_sdl2 as pygame
 * import threading             # <<<<<<<<<<<<<<
 * import renpy
 * import gc
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_threading, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":28
 * import pygame_sdl2 as pygame
 * import threading
 * import renpy             # <<<<<<<<<<<<<<
 * import gc
 * import math
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_renpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_renpy, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":29
 * import threading
 * import renpy
 * import gc             # <<<<<<<<<<<<<<
 * import math
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_gc, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gc, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":30
 * import renpy
 * import gc
 * import math             # <<<<<<<<<<<<<<
 * 
 * # We grab the blit lock each time it is necessary to blit
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_1) < 0) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":35
 * # something. This allows call to the pygame.transform functions to
 * # disable blitting, should it prove necessary.
 * blit_lock = threading.Condition()             # <<<<<<<<<<<<<<
 * 
 * # This is a dictionary containing all the renders that we know of. It's a
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Condition); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __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, 35, __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, 35, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_blit_lock, __pyx_t_1) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":40
 * # map from displayable to dictionaries containing the render of that
 * # displayable.
 * render_cache = collections.defaultdict(dict)             # <<<<<<<<<<<<<<
 * 
 * # The queue of redraws. A list of (time, displayable) pairs.
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_collections); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __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_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)(&PyDict_Type))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __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_3, ((PyObject *)(&PyDict_Type))};
      __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __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[2] = {__pyx_t_3, ((PyObject *)(&PyDict_Type))};
      __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(((PyObject *)(&PyDict_Type)));
      __Pyx_GIVEREF(((PyObject *)(&PyDict_Type)));
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)(&PyDict_Type)));
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_cache, __pyx_t_1) < 0) __PYX_ERR(0, 40, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":43
 * 
 * # The queue of redraws. A list of (time, displayable) pairs.
 * redraw_queue = [ ]             # <<<<<<<<<<<<<<
 * 
 * # The render returned from render_screen.
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_redraw_queue, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":46
 * 
 * # The render returned from render_screen.
 * screen_render = None             # <<<<<<<<<<<<<<
 * 
 * # A list of renders the system knows about, and thinks are still alive.
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_screen_render, Py_None) < 0) __PYX_ERR(0, 46, __pyx_L1_error)

  /* "renpy/display/render.pyx":50
 * # A list of renders the system knows about, and thinks are still alive.
 * cdef list live_renders
 * live_renders = [ ]             # <<<<<<<<<<<<<<
 * 
 * # A copy of renpy.display.interface.frame_time, for speed reasons.
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XGOTREF(__pyx_v_5renpy_7display_6render_live_renders);
  __Pyx_DECREF_SET(__pyx_v_5renpy_7display_6render_live_renders, ((PyObject*)__pyx_t_1));
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":54
 * # A copy of renpy.display.interface.frame_time, for speed reasons.
 * cdef double frame_time
 * frame_time = 0             # <<<<<<<<<<<<<<
 * 
 * # Are we doing a per_frame update?
 */
  __pyx_v_5renpy_7display_6render_frame_time = 0.0;

  /* "renpy/display/render.pyx":57
 * 
 * # Are we doing a per_frame update?
 * per_frame = False             # <<<<<<<<<<<<<<
 * 
 * def adjust_render_cache_times(old_time, new_time):
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_per_frame, Py_False) < 0) __PYX_ERR(0, 57, __pyx_L1_error)

  /* "renpy/display/render.pyx":59
 * per_frame = False
 * 
 * def adjust_render_cache_times(old_time, new_time):             # <<<<<<<<<<<<<<
 *     """
 *     This adjusts the render cache such that if a render starts at
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_1adjust_render_cache_times, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_adjust_render_cache_times, __pyx_t_1) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":91
 * 
 * 
 * def free_memory():             # <<<<<<<<<<<<<<
 *     """
 *     Frees memory used by the render system.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_3free_memory, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_free_memory, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":107
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_5check_at_shutdown, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_at_shutdown, __pyx_t_1) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":134
 * # The number of things being rendered at the moment.
 * cdef int rendering
 * rendering = 0             # <<<<<<<<<<<<<<
 * 
 * # The st and at of the current call to render.
 */
  __pyx_v_5renpy_7display_6render_rendering = 0;

  /* "renpy/display/render.pyx":137
 * 
 * # The st and at of the current call to render.
 * render_st = 0.0             # <<<<<<<<<<<<<<
 * render_at = 0.0
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_st, __pyx_float_0_0) < 0) __PYX_ERR(0, 137, __pyx_L1_error)

  /* "renpy/display/render.pyx":138
 * # The st and at of the current call to render.
 * render_st = 0.0
 * render_at = 0.0             # <<<<<<<<<<<<<<
 * 
 * cdef bint render_is_ready
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_at, __pyx_float_0_0) < 0) __PYX_ERR(0, 138, __pyx_L1_error)

  /* "renpy/display/render.pyx":141
 * 
 * cdef bint render_is_ready
 * render_is_ready = 0             # <<<<<<<<<<<<<<
 * 
 * def render_ready():
 */
  __pyx_v_5renpy_7display_6render_render_is_ready = 0;

  /* "renpy/display/render.pyx":143
 * render_is_ready = 0
 * 
 * def render_ready():             # <<<<<<<<<<<<<<
 *     global render_is_ready
 *     render_is_ready = 1
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_7render_ready, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_ready, __pyx_t_1) < 0) __PYX_ERR(0, 143, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":261
 *     return rv
 * 
 * def invalidate(d):             # <<<<<<<<<<<<<<
 *     """
 *     Removes d from the render cache. If we're not in a redraw, triggers
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_11invalidate, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_invalidate, __pyx_t_1) < 0) __PYX_ERR(0, 261, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":277
 * 
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Called to determine if any redraws are pending. Returns true if we
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_13process_redraws, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_process_redraws, __pyx_t_1) < 0) __PYX_ERR(0, 277, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":325
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_15redraw_time, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_redraw_time, __pyx_t_1) < 0) __PYX_ERR(0, 325, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":336
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_17redraw, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_redraw, __pyx_t_1) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":424
 * 
 * 
 * IDENTITY = Matrix2D(1, 0, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6render_Matrix2D), __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IDENTITY, __pyx_t_1) < 0) __PYX_ERR(0, 424, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":428
 * 
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_19take_focuses, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_take_focuses, __pyx_t_1) < 0) __PYX_ERR(0, 428, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":442
 * # The result of focus_at_point for a modal render. This overrides any
 * # specific focus from below us.
 * Modal = renpy.object.Sentinel("Modal")             # <<<<<<<<<<<<<<
 * 
 * def focus_at_point(x, y):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __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_Sentinel); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Modal, __pyx_t_2) < 0) __PYX_ERR(0, 442, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":444
 * Modal = renpy.object.Sentinel("Modal")
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_21focus_at_point, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_focus_at_point, __pyx_t_2) < 0) __PYX_ERR(0, 444, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":461
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_23mutated_surface, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutated_surface, __pyx_t_2) < 0) __PYX_ERR(0, 461, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":469
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_25render_screen, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_screen, __pyx_t_2) < 0) __PYX_ERR(0, 469, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":496
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_27mark_sweep, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mark_sweep, __pyx_t_2) < 0) __PYX_ERR(0, 496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":536
 *     live_renders = worklist
 * 
 * def compute_subline(sx0, sw, cx0, cw):             # <<<<<<<<<<<<<<
 *     """
 *     Given a source line (start sx0, width sw) and a crop line (cx0, cw),
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_29compute_subline, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute_subline, __pyx_t_2) < 0) __PYX_ERR(0, 536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":570
 * 
 * # Possible operations that can be done as part of a render.
 * BLIT = 0             # <<<<<<<<<<<<<<
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_BLIT, __pyx_int_0) < 0) __PYX_ERR(0, 570, __pyx_L1_error)

  /* "renpy/display/render.pyx":571
 * # Possible operations that can be done as part of a render.
 * BLIT = 0
 * DISSOLVE = 1             # <<<<<<<<<<<<<<
 * IMAGEDISSOLVE = 2
 * PIXELLATE = 3
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DISSOLVE, __pyx_int_1) < 0) __PYX_ERR(0, 571, __pyx_L1_error)

  /* "renpy/display/render.pyx":572
 * BLIT = 0
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2             # <<<<<<<<<<<<<<
 * PIXELLATE = 3
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IMAGEDISSOLVE, __pyx_int_2) < 0) __PYX_ERR(0, 572, __pyx_L1_error)

  /* "renpy/display/render.pyx":573
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2
 * PIXELLATE = 3             # <<<<<<<<<<<<<<
 * 
 * cdef class Render:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PIXELLATE, __pyx_int_3) < 0) __PYX_ERR(0, 573, __pyx_L1_error)

  /* "renpy/display/render.pyx":828
 *         return rv
 * 
 *     pygame_surface = render_to_texture             # <<<<<<<<<<<<<<
 * 
 *     def subsurface(self, rect, focus=False):
 */
  __pyx_t_2 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_5renpy_7display_6render_Render, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5renpy_7display_6render_Render->tp_dict, __pyx_n_s_pygame_surface, __pyx_t_2) < 0) __PYX_ERR(0, 828, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  PyType_Modified(__pyx_ptype_5renpy_7display_6render_Render);

  /* "renpy/display/render.pyx":1418
 *             self.forward *= Matrix2D(0, 0, 0, 0)
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__40); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__40, __pyx_n_s_Canvas, __pyx_n_s_Canvas, (PyObject *) NULL, __pyx_n_s_renpy_display_render, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);

  /* "renpy/display/render.pyx":1420
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_1__init__, 0, __pyx_n_s_Canvas___init, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 1420, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1423
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_3rect, 0, __pyx_n_s_Canvas_rect, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__44)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__45);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_rect, __pyx_t_4) < 0) __PYX_ERR(0, 1423, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1434
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_5polygon, 0, __pyx_n_s_Canvas_polygon, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__48);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_polygon, __pyx_t_4) < 0) __PYX_ERR(0, 1434, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1444
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_7circle, 0, __pyx_n_s_Canvas_circle, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__51);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_circle, __pyx_t_4) < 0) __PYX_ERR(0, 1444, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1457
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_9ellipse, 0, __pyx_n_s_Canvas_ellipse, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__54);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_ellipse, __pyx_t_4) < 0) __PYX_ERR(0, 1457, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1468
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_11arc, 0, __pyx_n_s_Canvas_arc, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__57);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_arc, __pyx_t_4) < 0) __PYX_ERR(0, 1468, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1481
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_13line, 0, __pyx_n_s_Canvas_line, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__60);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_line, __pyx_t_4) < 0) __PYX_ERR(0, 1481, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1492
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_15lines, 0, __pyx_n_s_Canvas_lines, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__63);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_lines, __pyx_t_4) < 0) __PYX_ERR(0, 1492, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1503
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_17aaline, 0, __pyx_n_s_Canvas_aaline, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__66);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_aaline, __pyx_t_4) < 0) __PYX_ERR(0, 1503, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1514
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_19aalines, 0, __pyx_n_s_Canvas_aalines, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__69);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_aalines, __pyx_t_4) < 0) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1525
 *             blit_lock.release()
 * 
 *     def get_surface(self):             # <<<<<<<<<<<<<<
 *         return self.surf
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_21get_surface, 0, __pyx_n_s_Canvas_get_surface, NULL, __pyx_n_s_renpy_display_render, __pyx_d, ((PyObject *)__pyx_codeobj__71)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1525, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_get_surface, __pyx_t_4) < 0) __PYX_ERR(0, 1525, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1418
 *             self.forward *= Matrix2D(0, 0, 0, 0)
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Canvas, __pyx_tuple__40, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Canvas, __pyx_t_4) < 0) __PYX_ERR(0, 1418, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Matrix2D(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     if __pyx_checksum != 0x3190674:
 *         from pickle import PickleError as __pyx_PickleError
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_31__pyx_unpickle_Matrix2D, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Matrix2D, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "(tree fragment)":9
 *         __pyx_unpickle_Matrix2D__set_state(<Matrix2D> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_Matrix2D__set_state(Matrix2D __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.xdx = __pyx_state[0]; __pyx_result.xdy = __pyx_state[1]; __pyx_result.ydx = __pyx_state[2]; __pyx_result.ydy = __pyx_state[3]
 *     if len(__pyx_state) > 4 and hasattr(__pyx_result, '__dict__'):
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_33__pyx_unpickle_Render, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Render, __pyx_t_2) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1
 * #cython: profile=False             # <<<<<<<<<<<<<<
 * # Copyright 2004-2018 Tom Rothamel <pytom@bishoujo.us>
 * #
 */
  __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /*--- 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);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init renpy.display.render", 0, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init renpy.display.render");
  }
  __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;
}

/* 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);
}

/* 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;
}

/* 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
}

/* 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

/* 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

/* 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

/* 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

/* 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;
}

/* 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");
}

/* 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);
}

/* 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;
}

/* RaiseNoneIterError */
  static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
  static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

/* UnpackTuple2 */
  static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
        PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
    PyObject *value1 = NULL, *value2 = NULL;
#if CYTHON_COMPILING_IN_PYPY
    value1 = PySequence_ITEM(tuple, 0);  if (unlikely(!value1)) goto bad;
    value2 = PySequence_ITEM(tuple, 1);  if (unlikely(!value2)) goto bad;
#else
    value1 = PyTuple_GET_ITEM(tuple, 0);  Py_INCREF(value1);
    value2 = PyTuple_GET_ITEM(tuple, 1);  Py_INCREF(value2);
#endif
    if (decref_tuple) {
        Py_DECREF(tuple);
    }
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
#if CYTHON_COMPILING_IN_PYPY
bad:
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
#endif
}
static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
                                       int has_known_size, int decref_tuple) {
    Py_ssize_t index;
    PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
    iternextfunc iternext;
    iter = PyObject_GetIter(tuple);
    if (unlikely(!iter)) goto bad;
    if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
    iternext = Py_TYPE(iter)->tp_iternext;
    value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
    value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
    if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
    Py_DECREF(iter);
    *pvalue1 = value1;
    *pvalue2 = value2;
    return 0;
unpacking_failed:
    if (!has_known_size && __Pyx_IterFinish() == 0)
        __Pyx_RaiseNeedMoreValuesError(index);
bad:
    Py_XDECREF(iter);
    Py_XDECREF(value1);
    Py_XDECREF(value2);
    if (decref_tuple) { Py_XDECREF(tuple); }
    return -1;
}

/* dict_iter */
  static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#elif PY_MAJOR_VERSION >= 3
        static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
        PyObject **pp = NULL;
        if (method_name) {
            const char *name = PyUnicode_AsUTF8(method_name);
            if (strcmp(name, "iteritems") == 0) pp = &py_items;
            else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
            else if (strcmp(name, "itervalues") == 0) pp = &py_values;
            if (pp) {
                if (!*pp) {
                    *pp = PyUnicode_FromString(name + 4);
                    if (!*pp)
                        return NULL;
                }
                method_name = *pp;
            }
        }
#endif
    }
    *p_orig_length = 0;
    if (method_name) {
        PyObject* iter;
        iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
        if (!iterable)
            return NULL;
#if !CYTHON_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_dict_iter_next(
        PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
        PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
    PyObject* next_item;
#if !CYTHON_COMPILING_IN_PYPY
    if (source_is_dict) {
        PyObject *key, *value;
        if (unlikely(orig_length != PyDict_Size(iter_obj))) {
            PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
            return -1;
        }
        if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
            return 0;
        }
        if (pitem) {
            PyObject* tuple = PyTuple_New(2);
            if (unlikely(!tuple)) {
                return -1;
            }
            Py_INCREF(key);
            Py_INCREF(value);
            PyTuple_SET_ITEM(tuple, 0, key);
            PyTuple_SET_ITEM(tuple, 1, value);
            *pitem = tuple;
        } else {
            if (pkey) {
                Py_INCREF(key);
                *pkey = key;
            }
            if (pvalue) {
                Py_INCREF(value);
                *pvalue = value;
            }
        }
        return 1;
    } else if (PyTuple_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyTuple_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else if (PyList_CheckExact(iter_obj)) {
        Py_ssize_t pos = *ppos;
        if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
        *ppos = pos + 1;
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
    } else
#endif
    {
        next_item = PyIter_Next(iter_obj);
        if (unlikely(!next_item)) {
            return __Pyx_IterFinish();
        }
    }
    if (pitem) {
        *pitem = next_item;
    } else if (pkey && pvalue) {
        if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
            return -1;
    } else if (pkey) {
        *pkey = next_item;
    } else {
        *pvalue = next_item;
    }
    return 1;
}

/* 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;
}

/* 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));
}

/* 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

/* 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

/* dict_getitem_default */
    static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    } else {
        if (default_value == Py_None)
            default_value = NULL;
        value = PyObject_CallMethodObjArgs(
            d, __pyx_n_s_get, key, default_value, NULL);
    }
#endif
    return value;
}

/* 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;
}

/* 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;
}

/* SwapException */
      #if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSwap(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
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}
#endif

/* None */
      static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* 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

/* 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;
}

/* 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;
}

/* WriteUnraisableException */
      static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback, CYTHON_UNUSED int nogil) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_PyThreadState_declare
#ifdef WITH_THREAD
    PyGILState_STATE state;
    if (nogil)
        state = PyGILState_Ensure();
#ifdef _MSC_VER
    else state = (PyGILState_STATE)-1;
#endif
#endif
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
#ifdef WITH_THREAD
    if (nogil)
        PyGILState_Release(state);
#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

/* 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);
}

/* SliceObject */
      static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_slice(obj, cstart, cstop);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_subscript))
#endif
    {
        PyObject* result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_subscript(obj, py_slice);
#else
        result = PyObject_GetItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name);
bad:
    return NULL;
}

/* SliceObject */
      static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
        Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
        int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
#if CYTHON_USE_TYPE_SLOTS
    PyMappingMethods* mp;
#if PY_MAJOR_VERSION < 3
    PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
    if (likely(ms && ms->sq_ass_slice)) {
        if (!has_cstart) {
            if (_py_start && (*_py_start != Py_None)) {
                cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
                if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstart = 0;
        }
        if (!has_cstop) {
            if (_py_stop && (*_py_stop != Py_None)) {
                cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
                if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
            } else
                cstop = PY_SSIZE_T_MAX;
        }
        if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
            Py_ssize_t l = ms->sq_length(obj);
            if (likely(l >= 0)) {
                if (cstop < 0) {
                    cstop += l;
                    if (cstop < 0) cstop = 0;
                }
                if (cstart < 0) {
                    cstart += l;
                    if (cstart < 0) cstart = 0;
                }
            } else {
                if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                    goto bad;
                PyErr_Clear();
            }
        }
        return ms->sq_ass_slice(obj, cstart, cstop, value);
    }
#endif
    mp = Py_TYPE(obj)->tp_as_mapping;
    if (likely(mp && mp->mp_ass_subscript))
#endif
    {
        int result;
        PyObject *py_slice, *py_start, *py_stop;
        if (_py_slice) {
            py_slice = *_py_slice;
        } else {
            PyObject* owned_start = NULL;
            PyObject* owned_stop = NULL;
            if (_py_start) {
                py_start = *_py_start;
            } else {
                if (has_cstart) {
                    owned_start = py_start = PyInt_FromSsize_t(cstart);
                    if (unlikely(!py_start)) goto bad;
                } else
                    py_start = Py_None;
            }
            if (_py_stop) {
                py_stop = *_py_stop;
            } else {
                if (has_cstop) {
                    owned_stop = py_stop = PyInt_FromSsize_t(cstop);
                    if (unlikely(!py_stop)) {
                        Py_XDECREF(owned_start);
                        goto bad;
                    }
                } else
                    py_stop = Py_None;
            }
            py_slice = PySlice_New(py_start, py_stop, Py_None);
            Py_XDECREF(owned_start);
            Py_XDECREF(owned_stop);
            if (unlikely(!py_slice)) goto bad;
        }
#if CYTHON_USE_TYPE_SLOTS
        result = mp->mp_ass_subscript(obj, py_slice, value);
#else
        result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
#endif
        if (!_py_slice) {
            Py_DECREF(py_slice);
        }
        return result;
    }
    PyErr_Format(PyExc_TypeError,
        "'%.200s' object does not support slice %.10s",
        Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
bad:
    return -1;
}

/* 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

/* PyIntFromDouble */
      #if PY_MAJOR_VERSION < 3
static CYTHON_INLINE PyObject* __Pyx_PyInt_FromDouble(double value) {
    if (value >= (double)LONG_MIN && value <= (double)LONG_MAX) {
        return PyInt_FromLong((long)value);
    }
    return PyLong_FromDouble(value);
}
#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

/* 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;
}

/* GetNameInClass */
        static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    return __Pyx_GetModuleGlobalName(name);
}
static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) {
    PyObject *result;
    result = __Pyx_PyObject_GetAttrStr(nmspace, name);
    if (!result) {
        result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
    }
    return result;
}

/* 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;
}

/* 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);
}

/* 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, 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);
    }
}

/* 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;
}

/* FunctionExport */
            static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
            goto bad;
    }
    tmp.fp = f;
#if PY_VERSION_HEX >= 0x02070000
    cobj = PyCapsule_New(tmp.p, sig, 0);
#else
    cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
#endif
    if (!cobj)
        goto bad;
    if (PyDict_SetItemString(d, name, cobj) < 0)
        goto bad;
    Py_DECREF(cobj);
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(cobj);
    Py_XDECREF(d);
    return -1;
}

/* 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 */
