/* Generated by Cython 0.29.20 */

#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_29_20"
#define CYTHON_HEX_VERSION 0x001D14F0
#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
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 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
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 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 (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #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
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#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 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"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #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)
#endif
  #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
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *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 | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#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_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(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
#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 PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#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 CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#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
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? 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
#ifndef PyObject_Unicode
  #define PyObject_Unicode             PyObject_Str
#endif
#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
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#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) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#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

#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_MARK_ERR_POS(f_index, lineno) \
    { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
#define __PYX_ERR(f_index, lineno, Ln_error) \
    { __PYX_MARK_ERR_POS(f_index, lineno) 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
/* Early includes */
#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_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#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)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#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)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(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) + 1);
    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 = NULL;
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",
  "matrix.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_5renpy_7display_6matrix_Matrix;
struct __pyx_obj_5renpy_7display_6matrix_Matrix2D;
struct __pyx_obj_5renpy_7display_6render_Render;
struct __pyx_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":108
 *     # operations ###############################################################
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)             # <<<<<<<<<<<<<<
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 *     cpdef int absolute_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 */
struct __pyx_opt_args_5renpy_7display_6render_6Render_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

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

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

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


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


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



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

struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix {
  void (*transform4)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float *, float, float, float, float);
  void (*transform3)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float, float, float, float);
  void (*transform2)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float, float, float, float);
  int (*is_unit_aligned)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, int __pyx_skip_dispatch);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*inverse)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, int __pyx_skip_dispatch);
  int (*is_drawable_aligned)(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, struct __pyx_obj_5renpy_7display_6matrix_Matrix *);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*cidentity)(void);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*coffset)(float, float, float);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*crotate)(float, float, float);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*cscale)(float, float, float);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*cperspective)(float, float, float, float, float);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*cscreen_projection)(float, float);
  struct __pyx_obj_5renpy_7display_6matrix_Matrix *(*ctexture_projection)(float, float);
};
static struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix *__pyx_vtabptr_5renpy_7display_6matrix_Matrix;
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform4(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float *, float, float, float, float);
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform3(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float *, float, float, float, float);
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform2(struct __pyx_obj_5renpy_7display_6matrix_Matrix *, float *, float *, float, float, float, float);


/* "renpy/display/matrix.pxd":75
 * 
 * 
 * cdef class Matrix2D(Matrix):             # <<<<<<<<<<<<<<
 *     pass
 */

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


/* "renpy/display/render.pyx":581
 * FLATTEN = 4
 * 
 * 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);
#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, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#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);

/* PyObjectGetMethod.proto */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);

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

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

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

/* PyObjectSetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* 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_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (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);

/* ObjectGetItem.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
#else
#define __Pyx_PyObject_GetItem(obj, key)  PyObject_GetItem(obj, key)
#endif

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

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

/* CallUnboundCMethod1.proto */
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
#else
#define __Pyx_CallUnboundCMethod1(cfunc, self, arg)  __Pyx__CallUnboundCMethod1(cfunc, self, arg)
#endif

/* CallUnboundCMethod2.proto */
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
#else
#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2)  __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
#endif

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

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

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

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

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

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

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

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED 1
#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;
    size_t defaults_size;  // used by FusedFunction for copying defaults
    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_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, 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);

/* CythonFunction.proto */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *closure,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);

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

/* pyfrozenset_new.proto */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it);

/* PySetContains.proto */
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq);

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

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

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

/* set_iter.proto */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set);
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set);

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
    (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, int zerodivision_check);
#else
#define __Pyx_PyFloat_DivideCObj(op1, op2, floatval, inplace, zerodivision_check)\
    ((inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2)))
    #endif

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

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

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

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

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

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

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

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

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

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

/* PyObjectGetAttrStrNoError.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);

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

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

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

/* Globals.proto */
static PyObject* __Pyx_Globals(void);

/* GetNameInClass.proto */
#define __Pyx_GetNameInClass(var, nmspace, name)  (var) = __Pyx__GetNameInClass(nmspace, name)
static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);

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

/* SetNameInClass.proto */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
#elif CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_SetNameInClass(ns, name, value)\
    (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
#else
#define __Pyx_SetNameInClass(ns, name, value)  PyObject_SetItem(ns, name, value)
#endif

/* 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
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* 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 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*/
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform4(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float *__pyx_v_ow, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w); /* proto*/
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform3(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w); /* proto*/
static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform2(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w); /* proto*/

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

/* Module declarations from 'renpy.display.render' */
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Render = 0;
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_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 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__5[] = "";
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_gl[] = "gl_";
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_key[] = "key";
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_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_dead[] = "dead ";
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_value[] = "value";
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_Matrix[] = "Matrix";
static const char __pyx_k_Render[] = "Render";
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_layout[] = "layout";
static const char __pyx_k_main_2[] = "__main__";
static const char __pyx_k_models[] = "models";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
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_sizing[] = "sizing";
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_FLATTEN[] = "FLATTEN";
static const char __pyx_k_Surface[] = "Surface";
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_garbage[] = "garbage";
static const char __pyx_k_heighto[] = "heighto";
static const char __pyx_k_objects[] = "objects";
static const char __pyx_k_orig_wh[] = "orig_wh";
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_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_Matrix2D[] = "Matrix2D";
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_old_sizing[] = "old_sizing";
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_check_modal[] = "check_modal";
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_load_texture[] = "load_texture";
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_render_width[] = "render_width";
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_check_redraws[] = "check_redraws";
static const char __pyx_k_interact_time[] = "interact_time";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_render_height[] = "render_height";
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_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_render_cache_d[] = "render_cache_d";
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_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_render_for_size[] = "render_for_size";
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_matrix[] = "renpy.display.matrix";
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_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_check_redraws_locals_lambda[] = "check_redraws.<locals>.<lambda>";
static const char __pyx_k_process_redraws_locals_lambda[] = "process_redraws.<locals>.<lambda>";
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_0x8c[] = "Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, visible_children, width, xclipping, yclipping))";
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_FLATTEN;
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_0x8c;
static PyObject *__pyx_n_s_Matrix;
static PyObject *__pyx_n_s_Matrix2D;
static PyObject *__pyx_n_s_Modal;
static PyObject *__pyx_n_s_PIXELLATE;
static PyObject *__pyx_n_s_PickleError;
static PyObject *__pyx_n_s_Render;
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_Surface;
static PyObject *__pyx_kp_s__5;
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_check_modal;
static PyObject *__pyx_n_s_check_redraws;
static PyObject *__pyx_n_s_check_redraws_locals_lambda;
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_kp_s_dead;
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_garbage;
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_gl;
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_items;
static PyObject *__pyx_n_s_iteritems;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_key;
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_layout;
static PyObject *__pyx_n_s_line;
static PyObject *__pyx_n_s_lines;
static PyObject *__pyx_n_s_load_texture;
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_models;
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_name_2;
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_sizing;
static PyObject *__pyx_n_s_old_time;
static PyObject *__pyx_n_s_opaque;
static PyObject *__pyx_n_s_orig_wh;
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_process_redraws_locals_lambda;
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_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_cache_d;
static PyObject *__pyx_n_s_render_for_size;
static PyObject *__pyx_n_s_render_height;
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_render_width;
static PyObject *__pyx_n_s_renders;
static PyObject *__pyx_n_s_renpy;
static PyObject *__pyx_n_s_renpy_display_matrix;
static PyObject *__pyx_n_s_renpy_display_render;
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_sizing;
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_value;
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_xmaximum;
static PyObject *__pyx_n_s_xzoom;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_yclipping;
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_10render_for_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d, PyObject *__pyx_v_width, PyObject *__pyx_v_height, PyObject *__pyx_v_st, PyObject *__pyx_v_at); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_12invalidate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_14check_redraws(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_16process_redraws(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_18redraw_time(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_20redraw(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d, PyObject *__pyx_v_when); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_22take_focuses(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_focuses); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_24focus_at_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_26mutated_surface(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_surf); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_28render_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_30mark_sweep(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_32compute_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_transform, 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_6matrix_Matrix *__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_48add_shader(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_shader); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_50add_uniform(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_52add_property(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* 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 int __pyx_pf_5renpy_7display_6render_6Render_5modal_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* 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_4mesh___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_4mesh_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_4mesh_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7shaders___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_7shaders_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_7shaders_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8uniforms___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_8uniforms_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_8uniforms_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10properties___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_10properties_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_10properties_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_14cached_texture___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_14cached_texture_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_14cached_texture_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12cached_model___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_12cached_model_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_12cached_model_4__del__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6loaded___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_7display_6render_6Render_6loaded_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_54__reduce_cython__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_56__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_34__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_Render(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
static PyObject *__pyx_float_0_0;
static PyObject *__pyx_float_1_0;
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_147483306;
static PyObject *__pyx_slice_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_slice__10;
static PyObject *__pyx_slice__12;
static PyObject *__pyx_slice__13;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__35;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__39;
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__50;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__56;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__62;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__66;
static PyObject *__pyx_tuple__68;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__72;
static PyObject *__pyx_tuple__74;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__16;
static PyObject *__pyx_codeobj__18;
static PyObject *__pyx_codeobj__19;
static PyObject *__pyx_codeobj__21;
static PyObject *__pyx_codeobj__23;
static PyObject *__pyx_codeobj__25;
static PyObject *__pyx_codeobj__27;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__36;
static PyObject *__pyx_codeobj__38;
static PyObject *__pyx_codeobj__40;
static PyObject *__pyx_codeobj__42;
static PyObject *__pyx_codeobj__44;
static PyObject *__pyx_codeobj__47;
static PyObject *__pyx_codeobj__49;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__55;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__67;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__73;
static PyObject *__pyx_codeobj__76;
static PyObject *__pyx_codeobj__78;
/* Late includes */

/* "renpy/display/render.pyx":74
 * models = 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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_old_time)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_new_time)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("adjust_render_cache_times", 1, 2, 2, 1); __PYX_ERR(0, 74, __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, 74, __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, 74, __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 *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("adjust_render_cache_times", 0);

  /* "renpy/display/render.pyx":80
 *     """
 * 
 *     for id_d, renders in (<dict> render_cache).iteritems():             # <<<<<<<<<<<<<<
 * 
 *         # Check to see if we have a render with st_base = old_time. If so,
 */
  __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __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, 80, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_dict_iterator(((PyObject*)__pyx_t_5), 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __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, 80, __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":84
 *         # 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, 84, __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, 84, __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, 84, __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, 84, __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, 84, __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, 84, __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, 84, __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":85
 *         # 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, 85, __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, 85, __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, 85, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_11) {

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

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

      /* "renpy/display/render.pyx":84
 *         # 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":88
 *                 break
 *         else:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         new_renders = { }
 */
      goto __pyx_L8_outer_continue;
    }
    goto __pyx_L6_break;

    /* "renpy/display/render.pyx":84
 *         # 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":90
 *             continue
 * 
 *         new_renders = { }             # <<<<<<<<<<<<<<
 * 
 *         for k, v in (<dict> renders).iteritems():
 */
    __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 90, __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":92
 *         new_renders = { }
 * 
 *         for k, v in (<dict> 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, 92, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_dict_iterator(((PyObject*)__pyx_v_renders), 1, __pyx_n_s_iteritems, (&__pyx_t_12), (&__pyx_t_7)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 92, __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, 92, __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":93
 * 
 *         for k, v in (<dict> 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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 4)) {
          if (size > 4) __Pyx_RaiseTooManyValuesError(4);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 93, __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, 93, __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, 93, __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, 93, __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, 93, __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":95
 *             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, 95, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 95, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (__pyx_t_11) {

        /* "renpy/display/render.pyx":96
 * 
 *             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":95
 *             w, h, st_base, at_base = k
 * 
 *             if st_base == old_time:             # <<<<<<<<<<<<<<
 *                 st_base = new_time
 * 
 */
      }

      /* "renpy/display/render.pyx":98
 *                 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, 98, __pyx_L1_error)
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (__pyx_t_11) {

        /* "renpy/display/render.pyx":99
 * 
 *             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":98
 *                 st_base = new_time
 * 
 *             if at_base == old_time:             # <<<<<<<<<<<<<<
 *                 at_base = new_time
 * 
 */
      }

      /* "renpy/display/render.pyx":101
 *                 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, 101, __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, 101, __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":103
 *             new_renders[(w, h, st_base, at_base)] = v
 * 
 *         render_cache[id_d] = new_renders             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __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, 103, __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":74
 * models = 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":106
 * 
 * 
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("free_memory", 0);

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

  /* "renpy/display/render.pyx":114
 *     screen_render = None
 * 
 *     mark_sweep()             # <<<<<<<<<<<<<<
 * 
 *     render_cache.clear()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_mark_sweep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __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":116
 *     mark_sweep()
 * 
 *     render_cache.clear()             # <<<<<<<<<<<<<<
 * 
 *     # This can hang onto a render.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __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, 116, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __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":119
 * 
 *     # This can hang onto a render.
 *     renpy.display.interface.surftree = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __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, 119, __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, 119, __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, 119, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":106
 * 
 * 
 * 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":122
 * 
 * 
 * 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 *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_at_shutdown", 0);

  /* "renpy/display/render.pyx":128
 *     """
 * 
 *     if not renpy.config.developer:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __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, 128, __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, 128, __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, 128, __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":129
 * 
 *     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":128
 *     """
 * 
 *     if not renpy.config.developer:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "renpy/display/render.pyx":131
 *         return
 * 
 *     free_memory()             # <<<<<<<<<<<<<<
 * 
 *     gc.collect()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_free_memory); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __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":133
 *     free_memory()
 * 
 *     gc.collect()             # <<<<<<<<<<<<<<
 * 
 *     if gc.garbage:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_gc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __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, 133, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __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":135
 *     gc.collect()
 * 
 *     if gc.garbage:             # <<<<<<<<<<<<<<
 *         del gc.garbage[:]
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_gc); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_garbage); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":136
 * 
 *     if gc.garbage:
 *         del gc.garbage[:]             # <<<<<<<<<<<<<<
 * 
 *     l = gc.get_objects()
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_gc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_garbage); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PyObject_DelSlice(__pyx_t_1, 0, 0, NULL, NULL, &__pyx_slice_, 0, 0, 1) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":135
 *     gc.collect()
 * 
 *     if gc.garbage:             # <<<<<<<<<<<<<<
 *         del gc.garbage[:]
 * 
 */
  }

  /* "renpy/display/render.pyx":138
 *         del gc.garbage[:]
 * 
 *     l = gc.get_objects()             # <<<<<<<<<<<<<<
 * 
 *     count = 0
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_gc); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __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, 138, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __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":140
 *     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":141
 * 
 *     count = 0
 *     objects = gc.get_objects()             # <<<<<<<<<<<<<<
 * 
 *     for i in objects:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_gc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __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, 141, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __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":143
 *     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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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":144
 * 
 *     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":145
 *     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, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __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":144
 * 
 *     for i in objects:
 *         if isinstance(i, Render):             # <<<<<<<<<<<<<<
 *             count += 1
 * 
 */
    }

    /* "renpy/display/render.pyx":143
 *     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":147
 *             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, 147, __pyx_L1_error)
  if (unlikely(__pyx_t_3)) {

    /* "renpy/display/render.pyx":148
 * 
 *     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_FormatSafe(__pyx_kp_s_d_Renders_are_alive_at_shutdown, __pyx_v_count); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __PYX_ERR(0, 148, __pyx_L1_error)

    /* "renpy/display/render.pyx":147
 *             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":122
 * 
 * 
 * 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":162
 * 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":164
 * def render_ready():
 *     global render_is_ready
 *     render_is_ready = 1             # <<<<<<<<<<<<<<
 * 
 * # These are good until the next call to render.
 */
  __pyx_v_5renpy_7display_6render_render_is_ready = 1;

  /* "renpy/display/render.pyx":162
 * 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":170
 * render_height = 0
 * 
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("render", 0);
  __Pyx_INCREF(__pyx_v_widtho);
  __Pyx_INCREF(__pyx_v_heighto);

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

      /* "renpy/display/render.pyx":205
 *     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__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __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, 205, __pyx_L1_error)

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

    /* "renpy/display/render.pyx":203
 *     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":207
 *             raise Exception("Displayables may not be rendered during the init phase.")
 * 
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)             # <<<<<<<<<<<<<<
 * 
 *     render_width = widtho
 */
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_st)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __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, 207, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 207, __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":209
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)
 * 
 *     render_width = widtho             # <<<<<<<<<<<<<<
 *     render_height = heighto
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_width, __pyx_v_widtho) < 0) __PYX_ERR(0, 209, __pyx_L1_error)

  /* "renpy/display/render.pyx":210
 * 
 *     render_width = widtho
 *     render_height = heighto             # <<<<<<<<<<<<<<
 * 
 *     id_d = id(d)
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_height, __pyx_v_heighto) < 0) __PYX_ERR(0, 210, __pyx_L1_error)

  /* "renpy/display/render.pyx":212
 *     render_height = heighto
 * 
 *     id_d = id(d)             # <<<<<<<<<<<<<<
 *     render_cache_d = render_cache[id_d]
 *     rv = render_cache_d.get(orig_wh, None)
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_id_d = __pyx_t_4;
  __pyx_t_4 = 0;

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

  /* "renpy/display/render.pyx":214
 *     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, 214, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyDict_GetItemDefault(__pyx_v_render_cache_d, __pyx_v_orig_wh, Py_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 214, __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_Render))))) __PYX_ERR(0, 214, __pyx_L1_error)
  __pyx_v_rv = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":216
 *     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":217
 * 
 *     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":216
 *     rv = render_cache_d.get(orig_wh, None)
 * 
 *     if rv is not None:             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  }

  /* "renpy/display/render.pyx":219
 *         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, 219, __pyx_L1_error)
  __pyx_v_orig_width = __pyx_t_6;
  __pyx_v_width = __pyx_t_6;

  /* "renpy/display/render.pyx":220
 * 
 *     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, 220, __pyx_L1_error)
  __pyx_v_orig_height = __pyx_t_6;
  __pyx_v_height = __pyx_t_6;

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

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

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

  /* "renpy/display/render.pyx":226
 *     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":227
 * 
 *     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":228
 *     if xmaximum is not None:
 *         if isinstance(xmaximum, float):
 *             width = width * xmaximum             # <<<<<<<<<<<<<<
 *         else:
 *             width = min(xmaximum, width)
 */
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_xmaximum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __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, 228, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_width = __pyx_t_6;

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

    /* "renpy/display/render.pyx":230
 *             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_4 = __pyx_v_xmaximum;
      __pyx_t_2 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 230, __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, 230, __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, 230, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_3 = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
      }
      __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, 230, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_width = __pyx_t_6;
    }
    __pyx_L7:;

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

  /* "renpy/display/render.pyx":232
 *             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":233
 * 
 *     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":234
 *     if ymaximum is not None:
 *         if isinstance(ymaximum, float):
 *             height = height * ymaximum             # <<<<<<<<<<<<<<
 *         else:
 *             height = min(ymaximum, height)
 */
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_ymaximum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __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, 234, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_height = __pyx_t_6;

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

    /* "renpy/display/render.pyx":236
 *             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_4 = __pyx_v_ymaximum;
      __pyx_t_7 = PyFloat_FromDouble(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __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, 236, __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, 236, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __pyx_t_2;
        __pyx_t_2 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_3 = __pyx_t_4;
      }
      __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, 236, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_height = __pyx_t_6;
    }
    __pyx_L9:;

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

  /* "renpy/display/render.pyx":238
 *             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":239
 * 
 *     if width < 0:
 *         width = 0             # <<<<<<<<<<<<<<
 *     if height < 0:
 *         height = 0
 */
    __pyx_v_width = 0.0;

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

  /* "renpy/display/render.pyx":240
 *     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":241
 *         width = 0
 *     if height < 0:
 *         height = 0             # <<<<<<<<<<<<<<
 * 
 *     if orig_width != width or orig_height != height:
 */
    __pyx_v_height = 0.0;

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

  /* "renpy/display/render.pyx":243
 *         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":244
 * 
 *     if orig_width != width or orig_height != height:
 *         widtho = width             # <<<<<<<<<<<<<<
 *         heighto = height
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_widtho, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":245
 *     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_3 = PyFloat_FromDouble(__pyx_v_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_heighto, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":246
 *         widtho = width
 *         heighto = height
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)             # <<<<<<<<<<<<<<
 *         rv = render_cache_d.get(wh, None)
 * 
 */
    __pyx_t_3 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_st)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_at)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 246, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __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_3);
    PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_4);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_v_wh = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":247
 *         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, 247, __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, 247, __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, 247, __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":249
 *         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":250
 * 
 *         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":249
 *         rv = render_cache_d.get(wh, None)
 * 
 *         if rv is not None:             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
    }

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

  /* "renpy/display/render.pyx":253
 * 
 *     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":255
 *         wh = orig_wh
 * 
 *     renpy.plog(2, "start render {!r}", d)             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_plog); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_8 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_3)) {
    PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_int_2, __pyx_kp_s_start_render_r, __pyx_v_d};
    __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __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[4] = {__pyx_t_4, __pyx_int_2, __pyx_kp_s_start_render_r, __pyx_v_d};
    __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __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_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __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_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_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

    /* "renpy/display/render.pyx":258
 * 
 *     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":259
 *     try:
 *         rendering += 1
 *         old_st = render_st             # <<<<<<<<<<<<<<
 *         old_at = render_at
 *         render_st = st
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_render_st); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L17_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_old_st = __pyx_t_2;
    __pyx_t_2 = 0;

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

    /* "renpy/display/render.pyx":261
 *         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, 261, __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, 261, __pyx_L17_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":262
 *         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, 262, __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, 262, __pyx_L17_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

      /* "renpy/display/render.pyx":267
 *         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, 267, __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_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 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":265
 *         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":266
 *     finally:
 *         rendering -= 1
 *         render_st = old_st             # <<<<<<<<<<<<<<
 *         render_at = old_at
 * 
 */
        if (unlikely(!__pyx_v_old_st)) { __Pyx_RaiseUnboundLocalError("old_st"); __PYX_ERR(0, 266, __pyx_L20_error) }
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_st, __pyx_v_old_st) < 0) __PYX_ERR(0, 266, __pyx_L20_error)

        /* "renpy/display/render.pyx":267
 *         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, 267, __pyx_L20_error) }
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_at, __pyx_v_old_at) < 0) __PYX_ERR(0, 267, __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":269
 *         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, 269, __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 (unlikely(__pyx_t_5)) {

    /* "renpy/display/render.pyx":270
 * 
 *     if rv.__class__ is not Render:
 *         raise Exception("{!r}.render() must return a Render.".format(d))             # <<<<<<<<<<<<<<
 * 
 *     rv.render_of.append(d)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_r_render_must_return_a_Render, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(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_2 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_10, __pyx_v_d) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_d);
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 270, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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(0, 270, __pyx_L1_error)

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

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

  /* "renpy/display/render.pyx":273
 * 
 *     rv.render_of.append(d)
 *     rv.cache_killed = False             # <<<<<<<<<<<<<<
 * 
 *     if d._clipping:
 */
  __pyx_v_rv->cache_killed = 0;

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

    /* "renpy/display/render.pyx":276
 * 
 *     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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_renpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_plog); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":277
 *     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_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_subsurface); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_rv->width); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = PyFloat_FromDouble(__pyx_v_rv->height); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_10);
    __pyx_t_2 = 0;
    __pyx_t_10 = 0;
    __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_focus, Py_True) < 0) __PYX_ERR(0, 277, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __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, 277, __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":278
 *         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, 278, __pyx_L1_error)

    /* "renpy/display/render.pyx":279
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)
 *         renpy.plog(4, "after clipping")             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __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, 279, __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__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __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":275
 *     rv.cache_killed = False
 * 
 *     if d._clipping:             # <<<<<<<<<<<<<<
 *         renpy.plog(4, "before clipping")
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 */
  }

  /* "renpy/display/render.pyx":282
 * 
 * 
 *     if not sizing:             # <<<<<<<<<<<<<<
 * 
 *         # This lookup is needed because invalidations are possible.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_sizing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __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, 282, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = ((!__pyx_t_5) != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":285
 * 
 *         # This lookup is needed because invalidations are possible.
 *         render_cache_d = render_cache[id_d]             # <<<<<<<<<<<<<<
 *         render_cache_d[wh] = rv
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_id_d); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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, 285, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_render_cache_d, ((PyObject*)__pyx_t_4));
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":286
 *         # This lookup is needed because invalidations are possible.
 *         render_cache_d = render_cache[id_d]
 *         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, 286, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_render_cache_d, __pyx_v_wh, ((PyObject *)__pyx_v_rv)) < 0)) __PYX_ERR(0, 286, __pyx_L1_error)

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

      /* "renpy/display/render.pyx":289
 * 
 *         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, 289, __pyx_L1_error)
      }
      if (unlikely(PyDict_SetItem(__pyx_v_render_cache_d, __pyx_v_orig_wh, ((PyObject *)__pyx_v_rv)) < 0)) __PYX_ERR(0, 289, __pyx_L1_error)

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

    /* "renpy/display/render.pyx":282
 * 
 * 
 *     if not sizing:             # <<<<<<<<<<<<<<
 * 
 *         # This lookup is needed because invalidations are possible.
 */
  }

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

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

  /* "renpy/display/render.pyx":170
 * render_height = 0
 * 
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_widtho)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 1); __PYX_ERR(0, 170, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_heighto)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 2); __PYX_ERR(0, 170, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_st)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 3); __PYX_ERR(0, 170, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_at)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 4); __PYX_ERR(0, 170, __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, 170, __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, 170, __pyx_L3_error)
    __pyx_v_at = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_at == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 170, __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, 170, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 170, __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":295
 *     return rv
 * 
 * def render_for_size(d, width, height, st, at):             # <<<<<<<<<<<<<<
 *     """
 *     This returns a render of `d`  that's useful for getting the size or
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_11render_for_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_10render_for_size[] = "\n    This returns a render of `d`  that's useful for getting the size or\n    screen location, but not for actual rendering.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_11render_for_size = {"render_for_size", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_11render_for_size, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_10render_for_size};
static PyObject *__pyx_pw_5renpy_7display_6render_11render_for_size(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_height = 0;
  PyObject *__pyx_v_st = 0;
  PyObject *__pyx_v_at = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render_for_size (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_d,&__pyx_n_s_width,&__pyx_n_s_height,&__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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_for_size", 1, 5, 5, 1); __PYX_ERR(0, 295, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_for_size", 1, 5, 5, 2); __PYX_ERR(0, 295, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_st)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_for_size", 1, 5, 5, 3); __PYX_ERR(0, 295, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_at)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_for_size", 1, 5, 5, 4); __PYX_ERR(0, 295, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render_for_size") < 0)) __PYX_ERR(0, 295, __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_width = values[1];
    __pyx_v_height = values[2];
    __pyx_v_st = values[3];
    __pyx_v_at = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render_for_size", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 295, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.render_for_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_10render_for_size(__pyx_self, __pyx_v_d, __pyx_v_width, __pyx_v_height, __pyx_v_st, __pyx_v_at);

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

static PyObject *__pyx_pf_5renpy_7display_6render_10render_for_size(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d, PyObject *__pyx_v_width, PyObject *__pyx_v_height, PyObject *__pyx_v_st, PyObject *__pyx_v_at) {
  PyObject *__pyx_v_id_d = NULL;
  PyObject *__pyx_v_orig_wh = NULL;
  PyObject *__pyx_v_render_cache_d = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_old_sizing = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  double __pyx_t_8;
  double __pyx_t_9;
  int __pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("render_for_size", 0);

  /* "renpy/display/render.pyx":303
 *     global sizing
 * 
 *     id_d = id(d)             # <<<<<<<<<<<<<<
 *     orig_wh = (width, height, frame_time-st, frame_time-at)
 *     render_cache_d = render_cache[id_d]
 */
  __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_id_d = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":304
 * 
 *     id_d = id(d)
 *     orig_wh = (width, height, frame_time-st, frame_time-at)             # <<<<<<<<<<<<<<
 *     render_cache_d = render_cache[id_d]
 *     rv = render_cache_d.get(orig_wh, None)
 */
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_5renpy_7display_6render_frame_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_v_st); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(__pyx_v_5renpy_7display_6render_frame_time); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_v_at); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 304, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_width);
  __Pyx_GIVEREF(__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_width);
  __Pyx_INCREF(__pyx_v_height);
  __Pyx_GIVEREF(__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_height);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_v_orig_wh = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":305
 *     id_d = id(d)
 *     orig_wh = (width, height, frame_time-st, frame_time-at)
 *     render_cache_d = render_cache[id_d]             # <<<<<<<<<<<<<<
 *     rv = render_cache_d.get(orig_wh, None)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_id_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_render_cache_d = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":306
 *     orig_wh = (width, height, frame_time-st, frame_time-at)
 *     render_cache_d = render_cache[id_d]
 *     rv = render_cache_d.get(orig_wh, None)             # <<<<<<<<<<<<<<
 * 
 *     if rv is not None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_render_cache_d, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_4 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_orig_wh, Py_None};
    __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  #if CYTHON_FAST_PYCCALL
  if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
    PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_orig_wh, Py_None};
    __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else
  #endif
  {
    __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__pyx_t_2) {
      __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
    }
    __Pyx_INCREF(__pyx_v_orig_wh);
    __Pyx_GIVEREF(__pyx_v_orig_wh);
    PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_orig_wh);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_rv = __pyx_t_3;
  __pyx_t_3 = 0;

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

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

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

  /* "renpy/display/render.pyx":311
 *         return rv
 * 
 *     old_sizing = sizing             # <<<<<<<<<<<<<<
 *     sizing = True
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sizing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 311, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_old_sizing = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":312
 * 
 *     old_sizing = sizing
 *     sizing = True             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sizing, Py_True) < 0) __PYX_ERR(0, 312, __pyx_L1_error)

  /* "renpy/display/render.pyx":314
 *     sizing = True
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         return render(d, width, height, st, at)
 *     finally:
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":315
 * 
 *     try:
 *         return render(d, width, height, st, at)             # <<<<<<<<<<<<<<
 *     finally:
 *         sizing = old_sizing
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_v_st); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 315, __pyx_L5_error)
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_at); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 315, __pyx_L5_error)
    __pyx_t_3 = __pyx_f_5renpy_7display_6render_render(__pyx_v_d, __pyx_v_width, __pyx_v_height, __pyx_t_8, __pyx_t_9, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 315, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L4_return;
  }

  /* "renpy/display/render.pyx":317
 *         return render(d, width, height, st, at)
 *     finally:
 *         sizing = old_sizing             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14) < 0)) __Pyx_ErrFetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
      __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_XGOTREF(__pyx_t_17);
      __pyx_t_4 = __pyx_lineno; __pyx_t_10 = __pyx_clineno; __pyx_t_11 = __pyx_filename;
      {
        if (unlikely(!__pyx_v_old_sizing)) { __Pyx_RaiseUnboundLocalError("old_sizing"); __PYX_ERR(0, 317, __pyx_L8_error) }
        if (PyDict_SetItem(__pyx_d, __pyx_n_s_sizing, __pyx_v_old_sizing) < 0) __PYX_ERR(0, 317, __pyx_L8_error)
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      }
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
      __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_10; __pyx_filename = __pyx_t_11;
      goto __pyx_L1_error;
      __pyx_L8_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      }
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_17 = __pyx_r;
      __pyx_r = 0;
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_sizing, __pyx_v_old_sizing) < 0) __PYX_ERR(0, 317, __pyx_L1_error)
      __pyx_r = __pyx_t_17;
      __pyx_t_17 = 0;
      goto __pyx_L0;
    }
  }

  /* "renpy/display/render.pyx":295
 *     return rv
 * 
 * def render_for_size(d, width, height, st, at):             # <<<<<<<<<<<<<<
 *     """
 *     This returns a render of `d`  that's useful for getting the size or
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.display.render.render_for_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id_d);
  __Pyx_XDECREF(__pyx_v_orig_wh);
  __Pyx_XDECREF(__pyx_v_render_cache_d);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XDECREF(__pyx_v_old_sizing);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":320
 * 
 * 
 * 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_13invalidate(PyObject *__pyx_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_5renpy_7display_6render_12invalidate[] = "\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_13invalidate = {"invalidate", (PyCFunction)__pyx_pw_5renpy_7display_6render_13invalidate, METH_O, __pyx_doc_5renpy_7display_6render_12invalidate};
static PyObject *__pyx_pw_5renpy_7display_6render_13invalidate(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_12invalidate(__pyx_self, ((PyObject *)__pyx_v_d));

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

static PyObject *__pyx_pf_5renpy_7display_6render_12invalidate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_v_v = NULL;
  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;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("invalidate", 0);

  /* "renpy/display/render.pyx":326
 *     """
 * 
 *     if (not rendering) and (not per_frame) and (not sizing):             # <<<<<<<<<<<<<<
 *         redraw(d, 0)
 *         return
 */
  __pyx_t_2 = ((!(__pyx_v_5renpy_7display_6render_rendering != 0)) != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_per_frame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = ((!__pyx_t_2) != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_sizing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 326, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = ((!__pyx_t_4) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":327
 * 
 *     if (not rendering) and (not per_frame) and (not sizing):
 *         redraw(d, 0)             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_redraw); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 327, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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_v_d, __pyx_int_0};
      __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __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_5)) {
      PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_v_d, __pyx_int_0};
      __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else
    #endif
    {
      __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 327, __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_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_d);
      __Pyx_INCREF(__pyx_int_0);
      __Pyx_GIVEREF(__pyx_int_0);
      PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_int_0);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":328
 *     if (not rendering) and (not per_frame) and (not sizing):
 *         redraw(d, 0)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     for v in list(render_cache[id(d)].values()):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

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

  /* "renpy/display/render.pyx":330
 *         return
 * 
 *     for v in list(render_cache[id(d)].values()):             # <<<<<<<<<<<<<<
 *         v.kill_cache()
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_d); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PySequence_List(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_t_8; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 330, __pyx_L1_error)
    #else
    __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_8);
    __pyx_t_8 = 0;

    /* "renpy/display/render.pyx":331
 * 
 *     for v in list(render_cache[id(d)].values()):
 *         v.kill_cache()             # <<<<<<<<<<<<<<
 * 
 * def check_redraws():
 */
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_kill_cache); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __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);
      }
    }
    __pyx_t_8 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "renpy/display/render.pyx":330
 *         return
 * 
 *     for v in list(render_cache[id(d)].values()):             # <<<<<<<<<<<<<<
 *         v.kill_cache()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":320
 * 
 * 
 * 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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __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":333
 *         v.kill_cache()
 * 
 * def check_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Returns true if a redraw is required, and False otherwise.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_15check_redraws(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_14check_redraws[] = "\n    Returns true if a redraw is required, and False otherwise.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_15check_redraws = {"check_redraws", (PyCFunction)__pyx_pw_5renpy_7display_6render_15check_redraws, METH_NOARGS, __pyx_doc_5renpy_7display_6render_14check_redraws};
static PyObject *__pyx_pw_5renpy_7display_6render_15check_redraws(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("check_redraws (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_14check_redraws(__pyx_self);

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

/* "renpy/display/render.pyx":338
 *     """
 * 
 *     redraw_queue.sort(key=lambda a : a[0])             # <<<<<<<<<<<<<<
 * 
 *     now = renpy.display.core.get_time()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_13check_redraws_lambda(PyObject *__pyx_self, PyObject *__pyx_v_a); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_13check_redraws_lambda = {"lambda", (PyCFunction)__pyx_pw_5renpy_7display_6render_13check_redraws_lambda, METH_O, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_13check_redraws_lambda(PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, ((PyObject *)__pyx_v_a));

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

static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __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.check_redraws.lambda", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":333
 *         v.kill_cache()
 * 
 * def check_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Returns true if a redraw is required, and False otherwise.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_14check_redraws(CYTHON_UNUSED PyObject *__pyx_self) {
  PyObject *__pyx_v_now = NULL;
  PyObject *__pyx_v_when = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_id_d = 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 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_redraws", 0);

  /* "renpy/display/render.pyx":338
 *     """
 * 
 *     redraw_queue.sort(key=lambda a : a[0])             # <<<<<<<<<<<<<<
 * 
 *     now = renpy.display.core.get_time()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sort); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5renpy_7display_6render_13check_redraws_lambda, 0, __pyx_n_s_check_redraws_locals_lambda, NULL, __pyx_n_s_renpy_display_render, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_3) < 0) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 338, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":340
 *     redraw_queue.sort(key=lambda a : a[0])
 * 
 *     now = renpy.display.core.get_time()             # <<<<<<<<<<<<<<
 * 
 *     for when, d in redraw_queue:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __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, 340, __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_core); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __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_get_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_now = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":342
 *     now = renpy.display.core.get_time()
 * 
 *     for when, d in redraw_queue:             # <<<<<<<<<<<<<<
 * 
 *         id_d = id(d)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_2 = __pyx_t_3; __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_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 342, __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, 342, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 342, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 342, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 342, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
      PyObject* sequence = __pyx_t_3;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 342, __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_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 342, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 342, __pyx_L1_error)
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 342, __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_6);
    __pyx_t_6 = 0;

    /* "renpy/display/render.pyx":344
 *     for when, d in redraw_queue:
 * 
 *         id_d = id(d)             # <<<<<<<<<<<<<<
 * 
 *         if id_d not in render_cache:
 */
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_d); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 344, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_id_d, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":346
 *         id_d = id(d)
 * 
 *         if id_d not in render_cache:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_id_d, __pyx_t_3, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 346, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (__pyx_t_10) {

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

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

    /* "renpy/display/render.pyx":349
 *             continue
 * 
 *         if when <= now:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
    __pyx_t_3 = PyObject_RichCompare(__pyx_v_when, __pyx_v_now, Py_LE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 349, __pyx_L1_error)
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 349, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_10) {

      /* "renpy/display/render.pyx":350
 * 
 *         if when <= now:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     return False
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;

      /* "renpy/display/render.pyx":349
 *             continue
 * 
 *         if when <= now:             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
    }

    /* "renpy/display/render.pyx":342
 *     now = renpy.display.core.get_time()
 * 
 *     for when, d in redraw_queue:             # <<<<<<<<<<<<<<
 * 
 *         id_d = id(d)
 */
    __pyx_L3_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":352
 *             return True
 * 
 *     return False             # <<<<<<<<<<<<<<
 * 
 * def process_redraws():
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":333
 *         v.kill_cache()
 * 
 * def check_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Returns true if a redraw is required, and False otherwise.
 */

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

/* "renpy/display/render.pyx":354
 *     return False
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Removes any pending redraws from the redraw queue.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_17process_redraws(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_16process_redraws[] = "\n    Removes any pending redraws from the redraw queue.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_17process_redraws = {"process_redraws", (PyCFunction)__pyx_pw_5renpy_7display_6render_17process_redraws, METH_NOARGS, __pyx_doc_5renpy_7display_6render_16process_redraws};
static PyObject *__pyx_pw_5renpy_7display_6render_17process_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_16process_redraws(__pyx_self);

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

/* "renpy/display/render.pyx":361
 *     global redraw_queue
 * 
 *     redraw_queue.sort(key=lambda a : a[0])             # <<<<<<<<<<<<<<
 * 
 *     now = renpy.display.core.get_time()
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_15process_redraws_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_a); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_15process_redraws_lambda1 = {"lambda1", (PyCFunction)__pyx_pw_5renpy_7display_6render_15process_redraws_lambda1, METH_O, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_15process_redraws_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0);
  __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, ((PyObject *)__pyx_v_a));

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

static PyObject *__pyx_lambda_funcdef_lambda1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lambda1", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __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.process_redraws.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":354
 *     return False
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Removes any pending redraws from the redraw queue.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_16process_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 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("process_redraws", 0);

  /* "renpy/display/render.pyx":361
 *     global redraw_queue
 * 
 *     redraw_queue.sort(key=lambda a : a[0])             # <<<<<<<<<<<<<<
 * 
 *     now = renpy.display.core.get_time()
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_sort); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5renpy_7display_6render_15process_redraws_lambda1, 0, __pyx_n_s_process_redraws_locals_lambda, NULL, __pyx_n_s_renpy_display_render, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_key, __pyx_t_3) < 0) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":363
 *     redraw_queue.sort(key=lambda a : a[0])
 * 
 *     now = renpy.display.core.get_time()             # <<<<<<<<<<<<<<
 *     rv = False
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __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, 363, __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_core); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 363, __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_get_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_now = __pyx_t_3;
  __pyx_t_3 = 0;

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

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

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

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

    /* "renpy/display/render.pyx":370
 * 
 *     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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 370, __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); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_t); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) __PYX_ERR(0, 370, __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, 370, __pyx_L1_error)
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_when, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":372
 *         when, d = t
 * 
 *         id_d = id(d)             # <<<<<<<<<<<<<<
 * 
 *         if id_d in seen:
 */
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_d); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_id_d, __pyx_t_1);
    __pyx_t_1 = 0;

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

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

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

    /* "renpy/display/render.pyx":377
 *             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, 377, __pyx_L1_error)

    /* "renpy/display/render.pyx":379
 *         seen.add(id_d)
 * 
 *         if id_d not in render_cache:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __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, 379, __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":380
 * 
 *         if id_d not in render_cache:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if when <= now:
 */
      goto __pyx_L3_continue;

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

    /* "renpy/display/render.pyx":382
 *             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, 382, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 382, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "renpy/display/render.pyx":388
 *             # children that we want to reuse.
 * 
 *             for v in list(render_cache[id_d].values()):             # <<<<<<<<<<<<<<
 *                 v.kill_cache()
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_render_cache); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_v_id_d); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 388, __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, 388, __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);
        }
      }
      __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PySequence_List(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      for (;;) {
        if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_3); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 388, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 388, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
        __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_3);
        __pyx_t_3 = 0;

        /* "renpy/display/render.pyx":389
 * 
 *             for v in list(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, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_12 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_3 = (__pyx_t_12) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_12) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "renpy/display/render.pyx":388
 *             # children that we want to reuse.
 * 
 *             for v in list(render_cache[id_d].values()):             # <<<<<<<<<<<<<<
 *                 v.kill_cache()
 * 
 */
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

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

    /* "renpy/display/render.pyx":394
 * 
 *         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, 394, __pyx_L1_error)
    }
    __pyx_L9:;

    /* "renpy/display/render.pyx":369
 *     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":396
 *             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, 396, __pyx_L1_error)

  /* "renpy/display/render.pyx":398
 *     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, 398, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":354
 *     return False
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Removes any pending redraws from the redraw queue.
 */

  /* 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_12);
  __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":401
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_19redraw_time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_18redraw_time[] = "\n    Returns the time at which the next redraw is scheduled.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_19redraw_time = {"redraw_time", (PyCFunction)__pyx_pw_5renpy_7display_6render_19redraw_time, METH_NOARGS, __pyx_doc_5renpy_7display_6render_18redraw_time};
static PyObject *__pyx_pw_5renpy_7display_6render_19redraw_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_18redraw_time(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_18redraw_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("redraw_time", 0);

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

    /* "renpy/display/render.pyx":407
 * 
 *     if redraw_queue:
 *         return redraw_queue[0][0]             # <<<<<<<<<<<<<<
 * 
 *     return None
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __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, 407, __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, 407, __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":406
 *     """
 * 
 *     if redraw_queue:             # <<<<<<<<<<<<<<
 *         return redraw_queue[0][0]
 * 
 */
  }

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

  /* "renpy/display/render.pyx":401
 * 
 * 
 * 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":412
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_21redraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_20redraw[] = "\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_21redraw = {"redraw", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_21redraw, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_20redraw};
static PyObject *__pyx_pw_5renpy_7display_6render_21redraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_when = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_d)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_when)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("redraw", 1, 2, 2, 1); __PYX_ERR(0, 412, __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, 412, __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, 412, __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_20redraw(__pyx_self, __pyx_v_d, __pyx_v_when);

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

static PyObject *__pyx_pf_5renpy_7display_6render_20redraw(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;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("redraw", 0);

  /* "renpy/display/render.pyx":420
 *     """
 * 
 *     if not renpy.game.interface:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __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, 420, __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, 420, __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, 420, __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":421
 * 
 *     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":420
 *     """
 * 
 *     if not renpy.game.interface:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  }

  /* "renpy/display/render.pyx":423
 *         return
 * 
 *     if per_frame:             # <<<<<<<<<<<<<<
 *         invalidate(d)
 *         return
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_per_frame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __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, 423, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":424
 * 
 *     if per_frame:
 *         invalidate(d)             # <<<<<<<<<<<<<<
 *         return
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_invalidate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_v_d) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_d);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __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":425
 *     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":423
 *         return
 * 
 *     if per_frame:             # <<<<<<<<<<<<<<
 *         invalidate(d)
 *         return
 */
  }

  /* "renpy/display/render.pyx":427
 *         return
 * 
 *     redraw_queue.append((when + renpy.game.interface.frame_time, d))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_redraw_queue); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_game); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_interface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_frame_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Add(__pyx_v_when, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_INCREF(__pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_d);
  __pyx_t_2 = 0;
  __pyx_t_6 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_t_5); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/display/render.pyx":412
 * 
 * 
 * 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_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":433
 * 
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_23take_focuses(PyObject *__pyx_self, PyObject *__pyx_v_focuses); /*proto*/
static char __pyx_doc_5renpy_7display_6render_22take_focuses[] = "\n    Adds a list of rectangular focus regions to the focuses list.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_23take_focuses = {"take_focuses", (PyCFunction)__pyx_pw_5renpy_7display_6render_23take_focuses, METH_O, __pyx_doc_5renpy_7display_6render_22take_focuses};
static PyObject *__pyx_pw_5renpy_7display_6render_23take_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_22take_focuses(__pyx_self, ((PyObject *)__pyx_v_focuses));

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

static PyObject *__pyx_pf_5renpy_7display_6render_22take_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_focuses", 0);

  /* "renpy/display/render.pyx":438
 *     """
 * 
 *     screen_render.take_focuses(             # <<<<<<<<<<<<<<
 *         0, 0,
 *         screen_render.width, screen_render.height,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 438, __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, 438, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":440
 *     screen_render.take_focuses(
 *         0, 0,
 *         screen_render.width, screen_render.height,             # <<<<<<<<<<<<<<
 *         IDENTITY,
 *         None,
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __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, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 440, __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, 440, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

  /* "renpy/display/render.pyx":443
 *         IDENTITY,
 *         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[8] = {__pyx_t_6, __pyx_int_0, __pyx_int_0, __pyx_t_4, __pyx_t_5, __pyx_t_2, Py_None, __pyx_v_focuses};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 7+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __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[8] = {__pyx_t_6, __pyx_int_0, __pyx_int_0, __pyx_t_4, __pyx_t_5, __pyx_t_2, Py_None, __pyx_v_focuses};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 7+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __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(7+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __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(Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, Py_None);
    __Pyx_INCREF(__pyx_v_focuses);
    __Pyx_GIVEREF(__pyx_v_focuses);
    PyTuple_SET_ITEM(__pyx_t_8, 6+__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, 438, __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":433
 * 
 * 
 * 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":449
 * 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_25focus_at_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_24focus_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_25focus_at_point = {"focus_at_point", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_25focus_at_point, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_24focus_at_point};
static PyObject *__pyx_pw_5renpy_7display_6render_25focus_at_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("focus_at_point", 1, 2, 2, 1); __PYX_ERR(0, 449, __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, 449, __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, 449, __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_24focus_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_24focus_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 *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("focus_at_point", 0);

  /* "renpy/display/render.pyx":455
 *     """
 * 
 *     if screen_render is None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __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":456
 * 
 *     if screen_render is None:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cf = screen_render.focus_at_point(x, y, None)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

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

  /* "renpy/display/render.pyx":458
 *         return None
 * 
 *     cf = screen_render.focus_at_point(x, y, None)             # <<<<<<<<<<<<<<
 *     if cf is None or cf is Modal:
 *         return None
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 458, __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, 458, __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, 458, __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, 458, __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, 458, __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, 458, __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":459
 * 
 *     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_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_Modal); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 459, __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":460
 *     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_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

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

  /* "renpy/display/render.pyx":462
 *         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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 462, __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, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 462, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 462, __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, 462, __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, 462, __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, 462, __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":463
 *     else:
 *         d, arg, screen = cf
 *         return renpy.display.focus.Focus(d, arg, None, None, None, None, screen)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __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, 463, __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, 463, __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, 463, __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, 463, __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, 463, __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, 463, __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, 463, __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":449
 * 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":466
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_27mutated_surface(PyObject *__pyx_self, PyObject *__pyx_v_surf); /*proto*/
static char __pyx_doc_5renpy_7display_6render_26mutated_surface[] = "\n    Called to indicate that the given surface has changed.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_27mutated_surface = {"mutated_surface", (PyCFunction)__pyx_pw_5renpy_7display_6render_27mutated_surface, METH_O, __pyx_doc_5renpy_7display_6render_26mutated_surface};
static PyObject *__pyx_pw_5renpy_7display_6render_27mutated_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_26mutated_surface(__pyx_self, ((PyObject *)__pyx_v_surf));

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

static PyObject *__pyx_pf_5renpy_7display_6render_26mutated_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mutated_surface", 0);

  /* "renpy/display/render.pyx":471
 *     """
 * 
 *     renpy.display.draw.mutated_surface(surf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 471, __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, 471, __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, 471, __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, 471, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surf) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surf);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 471, __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":466
 * 
 * 
 * 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_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":474
 * 
 * 
 * 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_29render_screen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_28render_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_29render_screen = {"render_screen", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_29render_screen, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_28render_screen};
static PyObject *__pyx_pw_5renpy_7display_6render_29render_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_root)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_screen", 1, 3, 3, 1); __PYX_ERR(0, 474, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_screen", 1, 3, 3, 2); __PYX_ERR(0, 474, __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, 474, __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, 474, __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_28render_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_28render_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("render_screen", 0);

  /* "renpy/display/render.pyx":484
 *     global frame_time
 * 
 *     interact_time = renpy.display.interface.interact_time             # <<<<<<<<<<<<<<
 *     frame_time = renpy.display.interface.frame_time
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __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, 484, __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, 484, __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, 484, __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":485
 * 
 *     interact_time = renpy.display.interface.interact_time
 *     frame_time = renpy.display.interface.frame_time             # <<<<<<<<<<<<<<
 * 
 *     if interact_time is None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 485, __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, 485, __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, 485, __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, 485, __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, 485, __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":487
 *     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":488
 * 
 *     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":487
 *     frame_time = renpy.display.interface.frame_time
 * 
 *     if interact_time is None:             # <<<<<<<<<<<<<<
 *         st = 0
 *     else:
 */
    goto __pyx_L3;
  }

  /* "renpy/display/render.pyx":490
 *         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, 490, __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, 490, __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":492
 *         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, 492, __pyx_L1_error)
  __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_st); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 492, __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, 492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rv = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":493
 * 
 *     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, 493, __pyx_L1_error)

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

  /* "renpy/display/render.pyx":497
 *     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, 497, __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);
    }
  }
  __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 497, __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":499
 *     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":474
 * 
 * 
 * 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":501
 *     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_31mark_sweep(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_30mark_sweep[] = "\n    This performs mark-and-sweep garbage collection on the live_renders\n    list.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_31mark_sweep = {"mark_sweep", (PyCFunction)__pyx_pw_5renpy_7display_6render_31mark_sweep, METH_NOARGS, __pyx_doc_5renpy_7display_6render_30mark_sweep};
static PyObject *__pyx_pw_5renpy_7display_6render_31mark_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_30mark_sweep(__pyx_self);

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

static PyObject *__pyx_pf_5renpy_7display_6render_30mark_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mark_sweep", 0);

  /* "renpy/display/render.pyx":513
 *     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, 513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_worklist = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":515
 *     worklist = [ ]
 * 
 *     if screen_render is not None:             # <<<<<<<<<<<<<<
 *         worklist.append(screen_render)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 515, __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":516
 * 
 *     if screen_render is not None:
 *         worklist.append(screen_render)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __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, 516, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

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

  /* "renpy/display/render.pyx":520
 *     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, 520, __pyx_L1_error)
    __pyx_t_3 = ((__pyx_v_i < __pyx_t_5) != 0);
    if (!__pyx_t_3) break;

    /* "renpy/display/render.pyx":521
 * 
 *     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, 521, __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, 521, __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":523
 *         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, 523, __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, 523, __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, 523, __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, 523, __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":524
 * 
 *         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":525
 *         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":526
 *             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, 526, __pyx_L1_error)

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

      /* "renpy/display/render.pyx":523
 *         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":528
 *                 worklist.append(j)
 * 
 *         i += 1             # <<<<<<<<<<<<<<
 * 
 *     if screen_render is not None:
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "renpy/display/render.pyx":530
 *         i += 1
 * 
 *     if screen_render is not None:             # <<<<<<<<<<<<<<
 *         screen_render.mark = True
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 530, __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":531
 * 
 *     if screen_render is not None:
 *         screen_render.mark = True             # <<<<<<<<<<<<<<
 * 
 *     for r in live_renders:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_screen_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 531, __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, 531, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* "renpy/display/render.pyx":533
 *         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, 533, __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, 533, __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, 533, __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, 533, __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":534
 * 
 *     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":535
 *     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, 535, __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);
        }
      }
      __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 535, __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":534
 * 
 *     for r in live_renders:
 *         if not r.mark:             # <<<<<<<<<<<<<<
 *             r.kill_cache()
 *         else:
 */
      goto __pyx_L12;
    }

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

    /* "renpy/display/render.pyx":533
 *         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":539
 *             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":501
 *     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":541
 *     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_33compute_subline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_32compute_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_33compute_subline = {"compute_subline", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_33compute_subline, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_32compute_subline};
static PyObject *__pyx_pw_5renpy_7display_6render_33compute_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sx0)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 1); __PYX_ERR(0, 541, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cx0)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 2); __PYX_ERR(0, 541, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cw)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 3); __PYX_ERR(0, 541, __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, 541, __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, 541, __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_32compute_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_32compute_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("compute_subline", 0);

  /* "renpy/display/render.pyx":553
 *     """
 * 
 *     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, 553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sx1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":554
 * 
 *     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, 554, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cx1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":556
 *     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, 556, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 556, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

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

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

  /* "renpy/display/render.pyx":559
 *         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":561
 *         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, 561, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_offset = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":562
 * 
 *     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, 562, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_crop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":564
 *     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, 564, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":565
 * 
 *     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, 565, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_width = __pyx_t_1;
    __pyx_t_1 = 0;

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

  /* "renpy/display/render.pyx":567
 *         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, 567, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_width = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L4:;

  /* "renpy/display/render.pyx":569
 *         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, 569, __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":541
 *     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":583
 * 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); __PYX_ERR(0, 583, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_draw_func);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layer_name);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 583, __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, 583, __pyx_L3_error)
    __pyx_v_height = __pyx_PyFloat_AsFloat(values[1]); if (unlikely((__pyx_v_height == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 583, __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, 583, __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, 583, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "renpy/display/render.pyx":594
 *         # 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":597
 * 
 *         # Is has this render been removed from the cache?
 *         self.cache_killed = False             # <<<<<<<<<<<<<<
 * 
 *         self.width = width
 */
  __pyx_v_self->cache_killed = 0;

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

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

  /* "renpy/display/render.pyx":602
 *         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":606
 *         # A list of (surface/render, xoffset, yoffset, focus, main) tuples, ordered from
 *         # back to front.
 *         self.children = [ ]             # <<<<<<<<<<<<<<
 * 
 *         # Forward is used to transform from screen coordinates to child
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __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":616
 *         # 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_6matrix_Matrix *)Py_None);

  /* "renpy/display/render.pyx":617
 *         # 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_6matrix_Matrix *)Py_None);

  /* "renpy/display/render.pyx":620
 * 
 *         # 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":624
 *         # 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":628
 *         # 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":631
 * 
 *         # 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":634
 * 
 *         # 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":637
 * 
 *         # 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":640
 * 
 *         # 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, 640, __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":644
 *         # 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":649
 *         # 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":654
 *         # 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":657
 * 
 *         # Should children be clipped to a rectangle?
 *         self.xclipping = False             # <<<<<<<<<<<<<<
 *         self.yclipping = False
 * 
 */
  __pyx_v_self->xclipping = 0;

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

  /* "renpy/display/render.pyx":661
 * 
 *         # Are we modal?
 *         self.modal = False             # <<<<<<<<<<<<<<
 * 
 *         # Are we a text input?
 */
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  __Pyx_GOTREF(__pyx_v_self->modal);
  __Pyx_DECREF(__pyx_v_self->modal);
  __pyx_v_self->modal = Py_False;

  /* "renpy/display/render.pyx":664
 * 
 *         # Are we a text input?
 *         self.text_input = False             # <<<<<<<<<<<<<<
 * 
 *         # gl, sw
 */
  __pyx_v_self->text_input = 0;

  /* "renpy/display/render.pyx":670
 *         # 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, 670, __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":673
 * 
 *         # 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, 673, __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":676
 * 
 *         # The operation we're performing. (BLIT, DISSOLVE, OR IMAGE_DISSOLVE)
 *         self.operation = BLIT             # <<<<<<<<<<<<<<
 * 
 *         # The fraction of the operation that is complete.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_BLIT); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 676, __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, 676, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_self->operation = __pyx_t_2;

  /* "renpy/display/render.pyx":679
 * 
 *         # 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":682
 * 
 *         # 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":685
 * 
 *         # The parameter to the operation.
 *         self.operation_parameter = 0             # <<<<<<<<<<<<<<
 * 
 *         # Caches of the texture created by rendering this surface.
 */
  __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":688
 * 
 *         # 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":689
 *         # 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":693
 *         # Cache of the texture created by rendering this surface at half size.
 *         # (This is set in gldraw.)
 *         self.half_cache = None             # <<<<<<<<<<<<<<
 * 
 *         # gl2
 */
  __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":700
 *         # and used to form a model. If this is True, the Mesh is taken from the first
 *         # child's Texture, otherwise this must be a Mesh.
 *         self.mesh = None             # <<<<<<<<<<<<<<
 * 
 *         # A tuple of shaders that will be used when rendering, or None.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->mesh);
  __Pyx_DECREF(__pyx_v_self->mesh);
  __pyx_v_self->mesh = Py_None;

  /* "renpy/display/render.pyx":703
 * 
 *         # A tuple of shaders that will be used when rendering, or None.
 *         self.shaders = None             # <<<<<<<<<<<<<<
 * 
 *         # A dictionary containing uniforms that will be used when rendering, or
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->shaders);
  __Pyx_DECREF(__pyx_v_self->shaders);
  __pyx_v_self->shaders = ((PyObject*)Py_None);

  /* "renpy/display/render.pyx":707
 *         # A dictionary containing uniforms that will be used when rendering, or
 *         # None.
 *         self.uniforms = None             # <<<<<<<<<<<<<<
 * 
 *         # Properties that are used for rendering.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->uniforms);
  __Pyx_DECREF(__pyx_v_self->uniforms);
  __pyx_v_self->uniforms = ((PyObject*)Py_None);

  /* "renpy/display/render.pyx":710
 * 
 *         # Properties that are used for rendering.
 *         self.properties = None             # <<<<<<<<<<<<<<
 * 
 *         # Used to cache the result of rendering this Render to a texture.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->properties);
  __Pyx_DECREF(__pyx_v_self->properties);
  __pyx_v_self->properties = ((PyObject*)Py_None);

  /* "renpy/display/render.pyx":713
 * 
 *         # Used to cache the result of rendering this Render to a texture.
 *         self.cached_texture = None             # <<<<<<<<<<<<<<
 * 
 *         # Used to cache the model.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->cached_texture);
  __Pyx_DECREF(__pyx_v_self->cached_texture);
  __pyx_v_self->cached_texture = Py_None;

  /* "renpy/display/render.pyx":716
 * 
 *         # Used to cache the model.
 *         self.cached_model = None             # <<<<<<<<<<<<<<
 * 
 *         # Have the textures been loaded?
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->cached_model);
  __Pyx_DECREF(__pyx_v_self->cached_model);
  __pyx_v_self->cached_model = Py_None;

  /* "renpy/display/render.pyx":719
 * 
 *         # Have the textures been loaded?
 *         self.loaded = False             # <<<<<<<<<<<<<<
 * 
 *         live_renders.append(self)
 */
  __pyx_v_self->loaded = 0;

  /* "renpy/display/render.pyx":721
 *         self.loaded = 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, 721, __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, 721, __pyx_L1_error)

  /* "renpy/display/render.pyx":583
 * 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":723
 *         live_renders.append(self)
 * 
 *     def __repr__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return "<{}Render {:x} of {!r}>".format(
 *             ("dead " if self.cache_killed else ""),
 */

/* 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;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__", 0);

  /* "renpy/display/render.pyx":724
 * 
 *     def __repr__(self): #@DuplicatedSignature
 *         return "<{}Render {:x} of {!r}>".format(             # <<<<<<<<<<<<<<
 *             ("dead " if self.cache_killed else ""),
 *             id(self),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Render_x_of_r, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "renpy/display/render.pyx":725
 *     def __repr__(self): #@DuplicatedSignature
 *         return "<{}Render {:x} of {!r}>".format(
 *             ("dead " if self.cache_killed else ""),             # <<<<<<<<<<<<<<
 *             id(self),
 *             self.render_of)
 */
  if ((__pyx_v_self->cache_killed != 0)) {
    __Pyx_INCREF(__pyx_kp_s_dead);
    __pyx_t_3 = __pyx_kp_s_dead;
  } else {
    __Pyx_INCREF(__pyx_kp_s__5);
    __pyx_t_3 = __pyx_kp_s__5;
  }

  /* "renpy/display/render.pyx":726
 *         return "<{}Render {:x} of {!r}>".format(
 *             ("dead " if self.cache_killed else ""),
 *             id(self),             # <<<<<<<<<<<<<<
 *             self.render_of)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 726, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);

  /* "renpy/display/render.pyx":727
 *             ("dead " if self.cache_killed else ""),
 *             id(self),
 *             self.render_of)             # <<<<<<<<<<<<<<
 * 
 *     def __getstate__(self): #@DuplicatedSignature
 */
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  #if CYTHON_FAST_PYCALL
  if (PyFunction_Check(__pyx_t_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_v_self->render_of};
    __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __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_2)) {
    PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_3, __pyx_t_4, __pyx_v_self->render_of};
    __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else
  #endif
  {
    __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_INCREF(__pyx_v_self->render_of);
    __Pyx_GIVEREF(__pyx_v_self->render_of);
    PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_self->render_of);
    __pyx_t_3 = 0;
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 724, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __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":723
 *         live_renders.append(self)
 * 
 *     def __repr__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return "<{}Render {:x} of {!r}>".format(
 *             ("dead " if self.cache_killed else ""),
 */

  /* 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_7);
  __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":729
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getstate__", 0);

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

    /* "renpy/display/render.pyx":731
 *     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__6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 731, __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, 731, __pyx_L1_error)

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

  /* "renpy/display/render.pyx":733
 *             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, 733, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }

  /* "renpy/display/render.pyx":729
 *             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":735
 *             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":736
 * 
 *     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":735
 *             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":738
 *         return
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render, Surface, or GL2Model) 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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;
        }
      }
    }
  }
  __Pyx_INCREF(__pyx_v_source);
  /* 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) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 738, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__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, 738, __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, 738, __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, 738, __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, 738, __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, 738, __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;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "renpy/display/render.pyx":749
 *         """
 * 
 *         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 (unlikely(__pyx_t_8)) {

    /* "renpy/display/render.pyx":750
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         if models:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 750, __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, 750, __pyx_L1_error)

    /* "renpy/display/render.pyx":749
 *         """
 * 
 *         if source is self:             # <<<<<<<<<<<<<<
 *             raise Exception("Blitting to self.")
 * 
 */
  }

  /* "renpy/display/render.pyx":752
 *             raise Exception("Blitting to self.")
 * 
 *         if models:             # <<<<<<<<<<<<<<
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_models); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 752, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":753
 * 
 *         if models:
 *             if isinstance(source, pygame.Surface):             # <<<<<<<<<<<<<<
 *                 source = renpy.display.draw.load_texture(source)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = PyObject_IsInstance(__pyx_v_source, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 753, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":754
 *         if models:
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)             # <<<<<<<<<<<<<<
 * 
 *         (xo, yo) = pos
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __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, 754, __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_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 754, __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_load_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __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);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_source) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_source);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "renpy/display/render.pyx":753
 * 
 *         if models:
 *             if isinstance(source, pygame.Surface):             # <<<<<<<<<<<<<<
 *                 source = renpy.display.draw.load_texture(source)
 * 
 */
    }

    /* "renpy/display/render.pyx":752
 *             raise Exception("Blitting to self.")
 * 
 *         if models:             # <<<<<<<<<<<<<<
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)
 */
  }

  /* "renpy/display/render.pyx":756
 *                 source = renpy.display.draw.load_texture(source)
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         xo = int(xo)
 */
  if (likely(__pyx_v_pos != Py_None)) {
    PyObject* sequence = __pyx_v_pos;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 756, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 756, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 756, __pyx_L1_error)
  }
  __pyx_v_xo = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_yo = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":758
 *         (xo, yo) = pos
 * 
 *         xo = int(xo)             # <<<<<<<<<<<<<<
 *         yo = int(yo)
 * 
 */
  __pyx_t_3 = __Pyx_PyNumber_Int(__pyx_v_xo); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_3);
  __pyx_t_3 = 0;

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

  /* "renpy/display/render.pyx":761
 *         yo = int(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":762
 * 
 *         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, 762, __pyx_L1_error)
    }
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 762, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->children, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 762, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

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

  /* "renpy/display/render.pyx":764
 *             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, 764, __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, 764, __pyx_L1_error)
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __pyx_t_9 = PyList_Insert(__pyx_v_self->children, __pyx_t_10, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 764, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":766
 *             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":767
 * 
 *         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, 767, __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, 767, __pyx_L1_error)

    /* "renpy/display/render.pyx":768
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_parents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_self));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":766
 *             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":770
 *             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":738
 *         return
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render, Surface, or GL2Model) 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_XDECREF(__pyx_v_source);
  __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, Surface, or GL2Model) 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("blit", 0, 2, 5, 1); __PYX_ERR(0, 738, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_focus);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_main);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 738, __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, 738, __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, 738, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 738, __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":772
 *         return 0
 * 
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render, Surface, or GL2Model) 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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;
        }
      }
    }
  }
  __Pyx_INCREF(__pyx_v_source);
  /* 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) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_subpixel_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__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, 772, __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, 772, __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, 772, __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, 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_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 772, __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;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "renpy/display/render.pyx":783
 *         """
 * 
 *         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 (unlikely(__pyx_t_8)) {

    /* "renpy/display/render.pyx":784
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         if models:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __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, 784, __pyx_L1_error)

    /* "renpy/display/render.pyx":783
 *         """
 * 
 *         if source is self:             # <<<<<<<<<<<<<<
 *             raise Exception("Blitting to self.")
 * 
 */
  }

  /* "renpy/display/render.pyx":786
 *             raise Exception("Blitting to self.")
 * 
 *         if models:             # <<<<<<<<<<<<<<
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_models); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 786, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":787
 * 
 *         if models:
 *             if isinstance(source, pygame.Surface):             # <<<<<<<<<<<<<<
 *                 source = renpy.display.draw.load_texture(source)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = PyObject_IsInstance(__pyx_v_source, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 787, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":788
 *         if models:
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)             # <<<<<<<<<<<<<<
 * 
 *         (xo, yo) = pos
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __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, 788, __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_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 788, __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_load_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __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);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_source) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_source);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "renpy/display/render.pyx":787
 * 
 *         if models:
 *             if isinstance(source, pygame.Surface):             # <<<<<<<<<<<<<<
 *                 source = renpy.display.draw.load_texture(source)
 * 
 */
    }

    /* "renpy/display/render.pyx":786
 *             raise Exception("Blitting to self.")
 * 
 *         if models:             # <<<<<<<<<<<<<<
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)
 */
  }

  /* "renpy/display/render.pyx":790
 *                 source = renpy.display.draw.load_texture(source)
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         xo = float(xo)
 */
  if (likely(__pyx_v_pos != Py_None)) {
    PyObject* sequence = __pyx_v_pos;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 790, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 790, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 790, __pyx_L1_error)
  }
  __pyx_v_xo = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_yo = __pyx_t_3;
  __pyx_t_3 = 0;

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

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

  /* "renpy/display/render.pyx":795
 *         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":796
 * 
 *         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, 796, __pyx_L1_error)
    }
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->children, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 796, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

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

  /* "renpy/display/render.pyx":798
 *             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, 798, __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, 798, __pyx_L1_error)
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 798, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __pyx_t_9 = PyList_Insert(__pyx_v_self->children, __pyx_t_10, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 798, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":800
 *             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":801
 * 
 *         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, 801, __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, 801, __pyx_L1_error)

    /* "renpy/display/render.pyx":802
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_parents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_self));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 802, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":800
 *             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":804
 *             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":772
 *         return 0
 * 
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render, Surface, or GL2Model) 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_XDECREF(__pyx_v_source);
  __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, Surface, or GL2Model) 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("subpixel_blit", 0, 2, 5, 1); __PYX_ERR(0, 772, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_focus);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_main);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 772, __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, 772, __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, 772, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 772, __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":806
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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;
        }
      }
    }
  }
  __Pyx_INCREF(__pyx_v_source);
  /* 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) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) {
    #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    static PY_UINT64_T __pyx_tp_dict_version = __PYX_DICT_VERSION_INIT, __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
    if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
      PY_UINT64_T __pyx_type_dict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      #endif
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_absolute_blit); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 806, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__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, 806, __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, 806, __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, 806, __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, 806, __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, 806, __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;
      }
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
      __pyx_tp_dict_version = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
      __pyx_obj_dict_version = __Pyx_get_object_dict_version(((PyObject *)__pyx_v_self));
      if (unlikely(__pyx_type_dict_guard != __pyx_tp_dict_version)) {
        __pyx_tp_dict_version = __pyx_obj_dict_version = __PYX_DICT_VERSION_INIT;
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
    }
    #endif
  }

  /* "renpy/display/render.pyx":817
 *         """
 * 
 *         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 (unlikely(__pyx_t_8)) {

    /* "renpy/display/render.pyx":818
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         if models:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 818, __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, 818, __pyx_L1_error)

    /* "renpy/display/render.pyx":817
 *         """
 * 
 *         if source is self:             # <<<<<<<<<<<<<<
 *             raise Exception("Blitting to self.")
 * 
 */
  }

  /* "renpy/display/render.pyx":820
 *             raise Exception("Blitting to self.")
 * 
 *         if models:             # <<<<<<<<<<<<<<
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_models); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 820, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":821
 * 
 *         if models:
 *             if isinstance(source, pygame.Surface):             # <<<<<<<<<<<<<<
 *                 source = renpy.display.draw.load_texture(source)
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pygame); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_Surface); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = PyObject_IsInstance(__pyx_v_source, __pyx_t_2); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = (__pyx_t_8 != 0);
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":822
 *         if models:
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)             # <<<<<<<<<<<<<<
 * 
 *         (xo, yo) = pos
 */
      __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __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, 822, __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_draw); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 822, __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_load_texture); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 822, __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);
        }
      }
      __pyx_t_2 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_1, __pyx_v_source) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_source);
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 822, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF_SET(__pyx_v_source, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "renpy/display/render.pyx":821
 * 
 *         if models:
 *             if isinstance(source, pygame.Surface):             # <<<<<<<<<<<<<<
 *                 source = renpy.display.draw.load_texture(source)
 * 
 */
    }

    /* "renpy/display/render.pyx":820
 *             raise Exception("Blitting to self.")
 * 
 *         if models:             # <<<<<<<<<<<<<<
 *             if isinstance(source, pygame.Surface):
 *                 source = renpy.display.draw.load_texture(source)
 */
  }

  /* "renpy/display/render.pyx":824
 *                 source = renpy.display.draw.load_texture(source)
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         xo = renpy.display.core.absolute(xo)
 */
  if (likely(__pyx_v_pos != Py_None)) {
    PyObject* sequence = __pyx_v_pos;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 824, __pyx_L1_error)
    }
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    #endif
  } else {
    __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 824, __pyx_L1_error)
  }
  __pyx_v_xo = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_yo = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":826
 *         (xo, yo) = pos
 * 
 *         xo = renpy.display.core.absolute(xo)             # <<<<<<<<<<<<<<
 *         yo = renpy.display.core.absolute(yo)
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __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, 826, __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_core); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 826, __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_absolute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, __pyx_v_xo) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_xo);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":827
 * 
 *         xo = renpy.display.core.absolute(xo)
 *         yo = renpy.display.core.absolute(yo)             # <<<<<<<<<<<<<<
 * 
 *         if index is None:
 */
  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_renpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __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, 827, __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_core); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 827, __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_absolute); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_1, __pyx_v_yo) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_yo);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 827, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":829
 *         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":830
 * 
 *         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, 830, __pyx_L1_error)
    }
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_self->children, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 830, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

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

  /* "renpy/display/render.pyx":832
 *             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, 832, __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, 832, __pyx_L1_error)
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __pyx_t_9 = PyList_Insert(__pyx_v_self->children, __pyx_t_10, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 832, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":834
 *             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":835
 * 
 *         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, 835, __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, 835, __pyx_L1_error)

    /* "renpy/display/render.pyx":836
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_source, __pyx_n_s_parents); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_add); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_1, function);
      }
    }
    __pyx_t_3 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)__pyx_v_self));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":834
 *             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":838
 *             source.parents.add(self)
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":806
 *         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_XDECREF(__pyx_v_source);
  __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_source)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("absolute_blit", 0, 2, 5, 1); __PYX_ERR(0, 806, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_focus);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_main);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 806, __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, 806, __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, 806, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 806, __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":841
 * 
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_size", 0);

  /* "renpy/display/render.pyx":848
 *         """
 * 
 *         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, 848, __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, 848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 848, __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":841
 * 
 * 
 *     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":851
 * 
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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 = __Pyx_PyDict_GetItemStr(__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, 851, __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, 851, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("render_to_texture", 0);

  /* "renpy/display/render.pyx":865
 *         """
 * 
 *         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, 865, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":866
 * 
 *         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":867
 *         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":866
 * 
 *         if alpha:
 *             if self.alpha_surface is not None:             # <<<<<<<<<<<<<<
 *                 return self.alpha_surface
 *         else:
 */
    }

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

  /* "renpy/display/render.pyx":869
 *                 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":870
 *         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":869
 *                 return self.alpha_surface
 *         else:
 *             if self.surface is not None:             # <<<<<<<<<<<<<<
 *                 return self.surface
 * 
 */
    }
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":872
 *                 return self.surface
 * 
 *         rv = renpy.display.draw.render_to_texture(self, alpha)             # <<<<<<<<<<<<<<
 * 
 *         # Stash and return the surface.
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __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, 872, __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, 872, __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, 872, __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, 872, __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, 872, __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, 872, __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, 872, __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":875
 * 
 *         # 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, 875, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":876
 *         # 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":875
 * 
 *         # Stash and return the surface.
 *         if alpha:             # <<<<<<<<<<<<<<
 *             self.alpha_surface = rv
 *         else:
 */
    goto __pyx_L6;
  }

  /* "renpy/display/render.pyx":878
 *             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":880
 *             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":851
 * 
 * 
 *     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":884
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__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 = __Pyx_PyDict_GetItemStr(__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, 884, __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, 884, __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_6matrix_Matrix *__pyx_v_reverse = NULL;
  PyObject *__pyx_v_forward = 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;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  struct __pyx_opt_args_5renpy_7display_6render_6Render_blit __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  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;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  PyObject *__pyx_t_22 = NULL;
  double __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("subsurface", 0);

  /* "renpy/display/render.pyx":890
 *         """
 * 
 *         (x, y, w, h) = rect             # <<<<<<<<<<<<<<
 * 
 *         x = int(x)
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_rect))) || (PyList_CheckExact(__pyx_v_rect))) {
    PyObject* sequence = __pyx_v_rect;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 890, __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, 890, __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, 890, __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, 890, __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, 890, __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":892
 *         (x, y, w, h) = rect
 * 
 *         x = int(x)             # <<<<<<<<<<<<<<
 *         y = int(y)
 *         w = int(w)
 */
  __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 892, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":893
 * 
 *         x = int(x)
 *         y = int(y)             # <<<<<<<<<<<<<<
 *         w = int(w)
 *         h = int(h)
 */
  __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_y); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 893, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":894
 *         x = int(x)
 *         y = int(y)
 *         w = int(w)             # <<<<<<<<<<<<<<
 *         h = int(h)
 * 
 */
  __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_w); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_w, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":895
 *         y = int(y)
 *         w = int(w)
 *         h = int(h)             # <<<<<<<<<<<<<<
 * 
 *         rv = Render(w, h)
 */
  __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF_SET(__pyx_v_h, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":897
 *         h = int(h)
 * 
 *         rv = Render(w, h)             # <<<<<<<<<<<<<<
 * 
 *         reverse = self.reverse
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 897, __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, 897, __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":899
 *         rv = Render(w, h)
 * 
 *         reverse = self.reverse             # <<<<<<<<<<<<<<
 * 
 *         if ((reverse is not None) and
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->reverse);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":901
 *         reverse = self.reverse
 * 
 *         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) {
    goto __pyx_L7_next_or;
  } else {
  }

  /* "renpy/display/render.pyx":902
 * 
 *         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":903
 *         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) or
 */
  __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":904
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or             # <<<<<<<<<<<<<<
 *             reverse.ydy != 1.0) or
 *             self.mesh):
 */
  __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":905
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or
 *             reverse.ydy != 1.0) or             # <<<<<<<<<<<<<<
 *             self.mesh):
 * 
 */
  __pyx_t_9 = ((__pyx_v_reverse->ydy != 1.0) != 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_7 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_L7_next_or:;

  /* "renpy/display/render.pyx":906
 *             reverse.ydx != 0.0 or
 *             reverse.ydy != 1.0) or
 *             self.mesh):             # <<<<<<<<<<<<<<
 * 
 *             # This doesn't actually make a subsurface, as we can't easily do
 */
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_self->mesh); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 906, __pyx_L1_error)
  __pyx_t_7 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;

  /* "renpy/display/render.pyx":901
 *         reverse = self.reverse
 * 
 *         if ((reverse is not None) and             # <<<<<<<<<<<<<<
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 */
  if (__pyx_t_7) {

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

    /* "renpy/display/render.pyx":912
 * 
 *             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":917
 *             # rectangle.
 * 
 *             if (reverse is None) or (reverse.xdx > 0.0 and             # <<<<<<<<<<<<<<
 *                                      reverse.xdy == 0.0 and
 *                                      reverse.ydx == 0.0 and
 */
    __pyx_t_9 = (((PyObject *)__pyx_v_reverse) == Py_None);
    __pyx_t_8 = (__pyx_t_9 != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_8 = ((__pyx_v_reverse->xdx > 0.0) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L13_bool_binop_done;
    }

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

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

    /* "renpy/display/render.pyx":920
 *                                      reverse.xdy == 0.0 and
 *                                      reverse.ydx == 0.0 and
 *                                      reverse.ydy > 0.0):             # <<<<<<<<<<<<<<
 * 
 *                 forward = self.forward or IDENTITY
 */
    __pyx_t_8 = ((__pyx_v_reverse->ydy > 0.0) != 0);
    __pyx_t_7 = __pyx_t_8;
    __pyx_L13_bool_binop_done:;

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

      /* "renpy/display/render.pyx":922
 *                                      reverse.ydy > 0.0):
 * 
 *                 forward = self.forward or IDENTITY             # <<<<<<<<<<<<<<
 * 
 *                 tx, ty = forward.transform(x, y)
 */
      __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->forward)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 922, __pyx_L1_error)
      if (!__pyx_t_7) {
      } else {
        __Pyx_INCREF(((PyObject *)__pyx_v_self->forward));
        __pyx_t_3 = ((PyObject *)__pyx_v_self->forward);
        goto __pyx_L18_bool_binop_done;
      }
      __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 922, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_L18_bool_binop_done:;
      __pyx_v_forward = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "renpy/display/render.pyx":924
 *                 forward = self.forward or IDENTITY
 * 
 *                 tx, ty = forward.transform(x, y)             # <<<<<<<<<<<<<<
 *                 tw, th = forward.transform(w + x, h + y)
 *                 rw, rh = forward.transform(self.width, self.height)
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_forward, __pyx_n_s_transform); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = NULL;
      __pyx_t_10 = 0;
      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);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
        PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_x, __pyx_v_y};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else
      #endif
      {
        __pyx_t_1 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        if (__pyx_t_2) {
          __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __pyx_t_2 = NULL;
        }
        __Pyx_INCREF(__pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_10, __pyx_v_x);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_10, __pyx_v_y);
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 924, __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;
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 924, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_1);
        #else
        __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 924, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
        index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L20_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        index = 1; __pyx_t_1 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L20_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 924, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L21_unpacking_done;
        __pyx_L20_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 924, __pyx_L1_error)
        __pyx_L21_unpacking_done:;
      }
      __pyx_v_tx = __pyx_t_4;
      __pyx_t_4 = 0;
      __pyx_v_ty = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "renpy/display/render.pyx":925
 * 
 *                 tx, ty = forward.transform(x, y)
 *                 tw, th = forward.transform(w + x, h + y)             # <<<<<<<<<<<<<<
 *                 rw, rh = forward.transform(self.width, self.height)
 * 
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_forward, __pyx_n_s_transform); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Add(__pyx_v_w, __pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = PyNumber_Add(__pyx_v_h, __pyx_v_y); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_5 = NULL;
      __pyx_t_10 = 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_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __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;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
        PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_4, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __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;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_5) {
          __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_2);
        __pyx_t_4 = 0;
        __pyx_t_2 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 925, __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_11 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_11);
        #else
        __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
        index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L22_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 1; __pyx_t_11 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_11)) goto __pyx_L22_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 925, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L23_unpacking_done;
        __pyx_L22_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 925, __pyx_L1_error)
        __pyx_L23_unpacking_done:;
      }
      __pyx_v_tw = __pyx_t_1;
      __pyx_t_1 = 0;
      __pyx_v_th = __pyx_t_11;
      __pyx_t_11 = 0;

      /* "renpy/display/render.pyx":926
 *                 tx, ty = forward.transform(x, y)
 *                 tw, th = forward.transform(w + x, h + y)
 *                 rw, rh = forward.transform(self.width, self.height)             # <<<<<<<<<<<<<<
 * 
 *                 if (tx <= 0) and (tw >= rw):
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_forward, __pyx_n_s_transform); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 926, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 926, __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, 926, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      __pyx_t_10 = 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_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_1, __pyx_t_2};
        __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else
      #endif
      {
        __pyx_t_5 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_4) {
          __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
        }
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_10, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_10, __pyx_t_2);
        __pyx_t_1 = 0;
        __pyx_t_2 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 926, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_5);
        #else
        __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
        index = 0; __pyx_t_11 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_11)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 1; __pyx_t_5 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_5)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 2) < 0) __PYX_ERR(0, 926, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        goto __pyx_L25_unpacking_done;
        __pyx_L24_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 926, __pyx_L1_error)
        __pyx_L25_unpacking_done:;
      }
      __pyx_v_rw = __pyx_t_11;
      __pyx_t_11 = 0;
      __pyx_v_rh = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":928
 *                 rw, rh = 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, 928, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 928, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_8) {
      } else {
        __pyx_t_7 = __pyx_t_8;
        goto __pyx_L27_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, 928, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 928, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __pyx_t_8;
      __pyx_L27_bool_binop_done:;
      if (__pyx_t_7) {

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

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

      /* "renpy/display/render.pyx":931
 *                     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, 931, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (__pyx_t_8) {
      } else {
        __pyx_t_7 = __pyx_t_8;
        goto __pyx_L30_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, 931, __pyx_L1_error)
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 931, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __pyx_t_8;
      __pyx_L30_bool_binop_done:;
      if (__pyx_t_7) {

        /* "renpy/display/render.pyx":932
 * 
 *                 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":931
 *                     rv.xclipping = False
 * 
 *                 if (ty <= 0) and (th >= rh):             # <<<<<<<<<<<<<<
 *                     rv.yclipping = False
 * 
 */
      }

      /* "renpy/display/render.pyx":917
 *             # rectangle.
 * 
 *             if (reverse is None) or (reverse.xdx > 0.0 and             # <<<<<<<<<<<<<<
 *                                      reverse.xdy == 0.0 and
 *                                      reverse.ydx == 0.0 and
 */
    }

    /* "renpy/display/render.pyx":934
 *                     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, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Negative(__pyx_v_y); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 934, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 934, __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_5);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_5);
    __pyx_t_3 = 0;
    __pyx_t_5 = 0;
    __pyx_t_12.__pyx_n = 2;
    __pyx_t_12.focus = __pyx_v_focus;
    __pyx_t_12.main = Py_True;
    ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)__pyx_v_rv->__pyx_vtab)->blit(__pyx_v_rv, ((PyObject *)__pyx_v_self), ((PyObject*)__pyx_t_11), 0, &__pyx_t_12); 
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

    /* "renpy/display/render.pyx":935
 * 
 *             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":901
 *         reverse = self.reverse
 * 
 *         if ((reverse is not None) and             # <<<<<<<<<<<<<<
 *             (reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 */
  }

  /* "renpy/display/render.pyx":940
 *         # 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, 940, __pyx_L1_error)
  }
  __pyx_t_11 = __pyx_v_self->children; __Pyx_INCREF(__pyx_t_11); __pyx_t_13 = 0;
  for (;;) {
    if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_11)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_13); __Pyx_INCREF(__pyx_t_5); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 940, __pyx_L1_error)
    #else
    __pyx_t_5 = PySequence_ITEM(__pyx_t_11, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 940, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 940, __pyx_L1_error)
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_14);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_1,&__pyx_t_4,&__pyx_t_14};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 940, __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_3,&__pyx_t_2,&__pyx_t_1,&__pyx_t_4,&__pyx_t_14};
      __pyx_t_15 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 940, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_15)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_6(__pyx_t_15); if (unlikely(!item)) goto __pyx_L34_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_15), 5) < 0) __PYX_ERR(0, 940, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L35_unpacking_done;
      __pyx_L34_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 940, __pyx_L1_error)
      __pyx_L35_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_1);
    __pyx_t_1 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cfocus, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cmain, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "renpy/display/render.pyx":943
 * 
 * 
 *             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_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_get_size); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_4 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
      }
    }
    __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_14);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 943, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 943, __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_4 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 943, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_14)) goto __pyx_L36_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_1); if (unlikely(!__pyx_t_4)) goto __pyx_L36_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_1), 2) < 0) __PYX_ERR(0, 943, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L37_unpacking_done;
      __pyx_L36_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, 943, __pyx_L1_error)
      __pyx_L37_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_childw, __pyx_t_14);
    __pyx_t_14 = 0;
    __Pyx_XDECREF_SET(__pyx_v_childh, __pyx_t_4);
    __pyx_t_4 = 0;

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

    /* "renpy/display/render.pyx":945
 *             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_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_compute_subline); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_1 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_14, function);
        __pyx_t_10 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_cy, __pyx_v_childh, __pyx_v_y, __pyx_v_h};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[5] = {__pyx_t_1, __pyx_v_cy, __pyx_v_childh, __pyx_v_y, __pyx_v_h};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else
    #endif
    {
      __pyx_t_4 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (__pyx_t_1) {
        __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cy);
      __Pyx_GIVEREF(__pyx_v_cy);
      PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_10, __pyx_v_cy);
      __Pyx_INCREF(__pyx_v_childh);
      __Pyx_GIVEREF(__pyx_v_childh);
      PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_10, __pyx_v_childh);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_10, __pyx_v_y);
      __Pyx_INCREF(__pyx_v_h);
      __Pyx_GIVEREF(__pyx_v_h);
      PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_10, __pyx_v_h);
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 3)) {
        if (size > 3) __Pyx_RaiseTooManyValuesError(3);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 945, __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_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      #else
      __pyx_t_14 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 945, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_14)) goto __pyx_L40_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L40_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_1 = __pyx_t_6(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L40_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_2), 3) < 0) __PYX_ERR(0, 945, __pyx_L1_error)
      __pyx_t_6 = NULL;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L41_unpacking_done;
      __pyx_L40_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_6 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 945, __pyx_L1_error)
      __pyx_L41_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_14);
    __pyx_t_14 = 0;
    __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_ch, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":947
 *             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_5 = PyObject_RichCompare(__pyx_v_cw, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 947, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L43_bool_binop_done;
    }
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_ch, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 947, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L43_bool_binop_done;
    }
    __pyx_t_5 = PyNumber_Subtract(__pyx_v_w, __pyx_v_xo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L43_bool_binop_done;
    }
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_h, __pyx_v_yo); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __pyx_t_8;
    __pyx_L43_bool_binop_done:;
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":948
 * 
 *             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_L32_continue;

      /* "renpy/display/render.pyx":947
 *             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":950
 *                 continue
 * 
 *             if cx < 0 or cx >= childw or cy < 0 or cy >= childh:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_cx, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L48_bool_binop_done;
    }
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_cx, __pyx_v_childw, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L48_bool_binop_done;
    }
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_cy, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (!__pyx_t_8) {
    } else {
      __pyx_t_7 = __pyx_t_8;
      goto __pyx_L48_bool_binop_done;
    }
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_cy, __pyx_v_childh, Py_GE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error)
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 950, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __pyx_t_8;
    __pyx_L48_bool_binop_done:;
    if (__pyx_t_7) {

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

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

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

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

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

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

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

            /* "renpy/display/render.pyx":960
 * 
 *                     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":959
 *                 if isinstance(child, Render):
 * 
 *                     if child.xclipping:             # <<<<<<<<<<<<<<
 *                         cropw = cw
 *                     else:
 */
            goto __pyx_L61;
          }

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

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

            /* "renpy/display/render.pyx":965
 * 
 *                     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":964
 *                         cropw = w - xo
 * 
 *                     if child.yclipping:             # <<<<<<<<<<<<<<
 *                         croph = ch
 *                     else:
 */
            goto __pyx_L62;
          }

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

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

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

          /* "renpy/display/render.pyx":971
 *                     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, 971, __pyx_L52_error)

          /* "renpy/display/render.pyx":972
 *                     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, 972, __pyx_L52_error)

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

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

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

          /* "renpy/display/render.pyx":978
 * 
 *                     crop = (cx, cy, cw, ch)
 *                     newchild = child.subsurface(crop)             # <<<<<<<<<<<<<<
 *                     renpy.display.draw.mutated_surface(newchild)
 * 
 */
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 978, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_1 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          __pyx_t_4 = (__pyx_t_1) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_1, __pyx_v_crop) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_v_crop);
          __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 978, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __Pyx_XDECREF_SET(__pyx_v_newchild, __pyx_t_4);
          __pyx_t_4 = 0;

          /* "renpy/display/render.pyx":979
 *                     crop = (cx, cy, cw, ch)
 *                     newchild = child.subsurface(crop)
 *                     renpy.display.draw.mutated_surface(newchild)             # <<<<<<<<<<<<<<
 * 
 *             except:
 */
          __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_renpy); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 979, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_14);
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_display); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_draw); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 979, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_mutated_surface); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 979, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_1, function);
            }
          }
          __pyx_t_4 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_14, __pyx_v_newchild) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_newchild);
          __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 979, __pyx_L52_error)
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        }
        __pyx_L60:;

        /* "renpy/display/render.pyx":956
 *             crop = None
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, Render):
 * 
 */
      }
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      goto __pyx_L59_try_end;
      __pyx_L52_error:;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":981
 *                     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_4, &__pyx_t_1, &__pyx_t_14) < 0) __PYX_ERR(0, 981, __pyx_L54_except_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_14);

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

      /* "renpy/display/render.pyx":956
 *             crop = None
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 if isinstance(child, Render):
 * 
 */
      __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);
      goto __pyx_L1_error;
      __pyx_L59_try_end:;
    }

    /* "renpy/display/render.pyx":984
 *                 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_12.__pyx_n = 2;
    __pyx_t_12.focus = __pyx_v_cfocus;
    __pyx_t_12.main = __pyx_v_cmain;
    ((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_12); 

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

  /* "renpy/display/render.pyx":986
 *             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, 986, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_8 = __pyx_t_7;
    goto __pyx_L66_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_self->focuses != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->focuses) != 0);
  __pyx_t_8 = __pyx_t_7;
  __pyx_L66_bool_binop_done:;
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":988
 *         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, 988, __pyx_L1_error)
    }
    __pyx_t_11 = __pyx_v_self->focuses; __Pyx_INCREF(__pyx_t_11); __pyx_t_13 = 0;
    for (;;) {
      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_11)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_14 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_13); __Pyx_INCREF(__pyx_t_14); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 988, __pyx_L1_error)
      #else
      __pyx_t_14 = PySequence_ITEM(__pyx_t_11, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 988, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
        PyObject* sequence = __pyx_t_14;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 9)) {
          if (size > 9) __Pyx_RaiseTooManyValuesError(9);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 988, __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_4 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_19 = PyTuple_GET_ITEM(sequence, 6); 
          __pyx_t_20 = PyTuple_GET_ITEM(sequence, 7); 
          __pyx_t_21 = PyTuple_GET_ITEM(sequence, 8); 
        } else {
          __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
          __pyx_t_15 = PyList_GET_ITEM(sequence, 4); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 5); 
          __pyx_t_19 = PyList_GET_ITEM(sequence, 6); 
          __pyx_t_20 = PyList_GET_ITEM(sequence, 7); 
          __pyx_t_21 = PyList_GET_ITEM(sequence, 8); 
        }
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_19);
        __Pyx_INCREF(__pyx_t_20);
        __Pyx_INCREF(__pyx_t_21);
        #else
        {
          Py_ssize_t i;
          PyObject** temps[9] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_5,&__pyx_t_15,&__pyx_t_3,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21};
          for (i=0; i < 9; i++) {
            PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 988, __pyx_L1_error)
            __Pyx_GOTREF(item);
            *(temps[i]) = item;
          }
        }
        #endif
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else {
        Py_ssize_t index = -1;
        PyObject** temps[9] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_2,&__pyx_t_5,&__pyx_t_15,&__pyx_t_3,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21};
        __pyx_t_22 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 988, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_22);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_22)->tp_iternext;
        for (index=0; index < 9; index++) {
          PyObject* item = __pyx_t_6(__pyx_t_22); if (unlikely(!item)) goto __pyx_L70_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_22), 9) < 0) __PYX_ERR(0, 988, __pyx_L1_error)
        __pyx_t_6 = NULL;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        goto __pyx_L71_unpacking_done;
        __pyx_L70_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0;
        __pyx_t_6 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 988, __pyx_L1_error)
        __pyx_L71_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_4);
      __pyx_t_4 = 0;
      __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_XDECREF_SET(__pyx_v_fw, __pyx_t_15);
      __pyx_t_15 = 0;
      __Pyx_XDECREF_SET(__pyx_v_fh, __pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mx, __pyx_t_19);
      __pyx_t_19 = 0;
      __Pyx_XDECREF_SET(__pyx_v_my, __pyx_t_20);
      __pyx_t_20 = 0;
      __Pyx_XDECREF_SET(__pyx_v_mask, __pyx_t_21);
      __pyx_t_21 = 0;

      /* "renpy/display/render.pyx":990
 *             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_8 = (__pyx_v_xo == Py_None);
      __pyx_t_7 = (__pyx_t_8 != 0);
      if (__pyx_t_7) {

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

        /* "renpy/display/render.pyx":992
 *                 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_L68_continue;

        /* "renpy/display/render.pyx":990
 *             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":994
 *                     continue
 * 
 *                 xo, cx, fw = compute_subline(xo, fw, x, w)             # <<<<<<<<<<<<<<
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_compute_subline); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 994, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_21);
      __pyx_t_19 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
        __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_21);
        if (likely(__pyx_t_19)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_19);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_21, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_21)) {
        PyObject *__pyx_temp[5] = {__pyx_t_19, __pyx_v_xo, __pyx_v_fw, __pyx_v_x, __pyx_v_w};
        __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
        PyObject *__pyx_temp[5] = {__pyx_t_19, __pyx_v_xo, __pyx_v_fw, __pyx_v_x, __pyx_v_w};
        __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      {
        __pyx_t_20 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        if (__pyx_t_19) {
          __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL;
        }
        __Pyx_INCREF(__pyx_v_xo);
        __Pyx_GIVEREF(__pyx_v_xo);
        PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_10, __pyx_v_xo);
        __Pyx_INCREF(__pyx_v_fw);
        __Pyx_GIVEREF(__pyx_v_fw);
        PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_10, __pyx_v_fw);
        __Pyx_INCREF(__pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_10, __pyx_v_x);
        __Pyx_INCREF(__pyx_v_w);
        __Pyx_GIVEREF(__pyx_v_w);
        PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_10, __pyx_v_w);
        __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_20, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      }
      __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
        PyObject* sequence = __pyx_t_14;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 994, __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_20 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_19 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_21 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_20 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_19 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_21);
        __Pyx_INCREF(__pyx_t_20);
        __Pyx_INCREF(__pyx_t_19);
        #else
        __pyx_t_21 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        __pyx_t_20 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_19 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        #endif
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_3 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 994, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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_L73_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_21);
        index = 1; __pyx_t_20 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_20)) goto __pyx_L73_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_20);
        index = 2; __pyx_t_19 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_19)) goto __pyx_L73_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_19);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 994, __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, 994, __pyx_L1_error)
        __pyx_L74_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_xo, __pyx_t_21);
      __pyx_t_21 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cx, __pyx_t_20);
      __pyx_t_20 = 0;
      __Pyx_DECREF_SET(__pyx_v_fw, __pyx_t_19);
      __pyx_t_19 = 0;

      /* "renpy/display/render.pyx":995
 * 
 *                 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_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_compute_subline); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 995, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_20 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_19))) {
        __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
        if (likely(__pyx_t_20)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_19, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_19)) {
        PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_v_yo, __pyx_v_fh, __pyx_v_y, __pyx_v_h};
        __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
        PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_v_yo, __pyx_v_fh, __pyx_v_y, __pyx_v_h};
        __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      {
        __pyx_t_21 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        if (__pyx_t_20) {
          __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_20); __pyx_t_20 = NULL;
        }
        __Pyx_INCREF(__pyx_v_yo);
        __Pyx_GIVEREF(__pyx_v_yo);
        PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_10, __pyx_v_yo);
        __Pyx_INCREF(__pyx_v_fh);
        __Pyx_GIVEREF(__pyx_v_fh);
        PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_10, __pyx_v_fh);
        __Pyx_INCREF(__pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_10, __pyx_v_y);
        __Pyx_INCREF(__pyx_v_h);
        __Pyx_GIVEREF(__pyx_v_h);
        PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_10, __pyx_v_h);
        __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_21, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
      }
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
        PyObject* sequence = __pyx_t_14;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 3)) {
          if (size > 3) __Pyx_RaiseTooManyValuesError(3);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 995, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_19 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_20 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          __pyx_t_19 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_21 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_20 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_19);
        __Pyx_INCREF(__pyx_t_21);
        __Pyx_INCREF(__pyx_t_20);
        #else
        __pyx_t_19 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_19);
        __pyx_t_21 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        __pyx_t_20 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        #endif
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_3 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 995, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
        index = 0; __pyx_t_19 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_19)) goto __pyx_L75_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_19);
        index = 1; __pyx_t_21 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_21)) goto __pyx_L75_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_21);
        index = 2; __pyx_t_20 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_20)) goto __pyx_L75_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_20);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 995, __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, 995, __pyx_L1_error)
        __pyx_L76_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_yo, __pyx_t_19);
      __pyx_t_19 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_21);
      __pyx_t_21 = 0;
      __Pyx_DECREF_SET(__pyx_v_fh, __pyx_t_20);
      __pyx_t_20 = 0;

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

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

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

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

        /* "renpy/display/render.pyx":1002
 *                 if mx is not None:
 * 
 *                     mw, mh = mask.get_size()             # <<<<<<<<<<<<<<
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)
 */
        __pyx_t_20 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s_get_size); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_21 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_20))) {
          __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_20);
          if (likely(__pyx_t_21)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
            __Pyx_INCREF(__pyx_t_21);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_20, function);
          }
        }
        __pyx_t_14 = (__pyx_t_21) ? __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_t_21) : __Pyx_PyObject_CallNoArg(__pyx_t_20);
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1002, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
          PyObject* sequence = __pyx_t_14;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1002, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_20 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_20 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_21 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(__pyx_t_21);
          #else
          __pyx_t_20 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1002, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_21 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1002, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          #endif
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_19 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1002, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_19)->tp_iternext;
          index = 0; __pyx_t_20 = __pyx_t_6(__pyx_t_19); if (unlikely(!__pyx_t_20)) goto __pyx_L81_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_20);
          index = 1; __pyx_t_21 = __pyx_t_6(__pyx_t_19); if (unlikely(!__pyx_t_21)) goto __pyx_L81_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_21);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_19), 2) < 0) __PYX_ERR(0, 1002, __pyx_L1_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          goto __pyx_L82_unpacking_done;
          __pyx_L81_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_6 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          __PYX_ERR(0, 1002, __pyx_L1_error)
          __pyx_L82_unpacking_done:;
        }
        __Pyx_XDECREF_SET(__pyx_v_mw, __pyx_t_20);
        __pyx_t_20 = 0;
        __Pyx_XDECREF_SET(__pyx_v_mh, __pyx_t_21);
        __pyx_t_21 = 0;

        /* "renpy/display/render.pyx":1004
 *                     mw, mh = mask.get_size()
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)             # <<<<<<<<<<<<<<
 *                     my, mcy, mh = compute_subline(my, mh, y, h)
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_compute_subline); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1004, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_21);
        __pyx_t_20 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
          __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_21);
          if (likely(__pyx_t_20)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
            __Pyx_INCREF(__pyx_t_20);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_21, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_21)) {
          PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_v_mx, __pyx_v_mw, __pyx_v_x, __pyx_v_w};
          __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_GOTREF(__pyx_t_14);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_21)) {
          PyObject *__pyx_temp[5] = {__pyx_t_20, __pyx_v_mx, __pyx_v_mw, __pyx_v_x, __pyx_v_w};
          __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_21, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_GOTREF(__pyx_t_14);
        } else
        #endif
        {
          __pyx_t_19 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          if (__pyx_t_20) {
            __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_20); __pyx_t_20 = NULL;
          }
          __Pyx_INCREF(__pyx_v_mx);
          __Pyx_GIVEREF(__pyx_v_mx);
          PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_10, __pyx_v_mx);
          __Pyx_INCREF(__pyx_v_mw);
          __Pyx_GIVEREF(__pyx_v_mw);
          PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_10, __pyx_v_mw);
          __Pyx_INCREF(__pyx_v_x);
          __Pyx_GIVEREF(__pyx_v_x);
          PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_10, __pyx_v_x);
          __Pyx_INCREF(__pyx_v_w);
          __Pyx_GIVEREF(__pyx_v_w);
          PyTuple_SET_ITEM(__pyx_t_19, 3+__pyx_t_10, __pyx_v_w);
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_21, __pyx_t_19, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        }
        __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
          PyObject* sequence = __pyx_t_14;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 3)) {
            if (size > 3) __Pyx_RaiseTooManyValuesError(3);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1004, __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_19 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_20 = PyTuple_GET_ITEM(sequence, 2); 
          } else {
            __pyx_t_21 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_19 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_20 = PyList_GET_ITEM(sequence, 2); 
          }
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_19);
          __Pyx_INCREF(__pyx_t_20);
          #else
          __pyx_t_21 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_19 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __pyx_t_20 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          #endif
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_3 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1004, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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_L83_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_21);
          index = 1; __pyx_t_19 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_19)) goto __pyx_L83_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_19);
          index = 2; __pyx_t_20 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_20)) goto __pyx_L83_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_20);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 1004, __pyx_L1_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L84_unpacking_done;
          __pyx_L83_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, 1004, __pyx_L1_error)
          __pyx_L84_unpacking_done:;
        }
        __Pyx_DECREF_SET(__pyx_v_mx, __pyx_t_21);
        __pyx_t_21 = 0;
        __Pyx_XDECREF_SET(__pyx_v_mcx, __pyx_t_19);
        __pyx_t_19 = 0;
        __Pyx_DECREF_SET(__pyx_v_mw, __pyx_t_20);
        __pyx_t_20 = 0;

        /* "renpy/display/render.pyx":1005
 * 
 *                     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_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_compute_subline); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1005, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        __pyx_t_19 = NULL;
        __pyx_t_10 = 0;
        if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) {
          __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_20);
          if (likely(__pyx_t_19)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20);
            __Pyx_INCREF(__pyx_t_19);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_20, function);
            __pyx_t_10 = 1;
          }
        }
        #if CYTHON_FAST_PYCALL
        if (PyFunction_Check(__pyx_t_20)) {
          PyObject *__pyx_temp[5] = {__pyx_t_19, __pyx_v_my, __pyx_v_mh, __pyx_v_y, __pyx_v_h};
          __pyx_t_14 = __Pyx_PyFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_GOTREF(__pyx_t_14);
        } else
        #endif
        #if CYTHON_FAST_PYCCALL
        if (__Pyx_PyFastCFunction_Check(__pyx_t_20)) {
          PyObject *__pyx_temp[5] = {__pyx_t_19, __pyx_v_my, __pyx_v_mh, __pyx_v_y, __pyx_v_h};
          __pyx_t_14 = __Pyx_PyCFunction_FastCall(__pyx_t_20, __pyx_temp+1-__pyx_t_10, 4+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_GOTREF(__pyx_t_14);
        } else
        #endif
        {
          __pyx_t_21 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          if (__pyx_t_19) {
            __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_19); __pyx_t_19 = NULL;
          }
          __Pyx_INCREF(__pyx_v_my);
          __Pyx_GIVEREF(__pyx_v_my);
          PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_10, __pyx_v_my);
          __Pyx_INCREF(__pyx_v_mh);
          __Pyx_GIVEREF(__pyx_v_mh);
          PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_10, __pyx_v_mh);
          __Pyx_INCREF(__pyx_v_y);
          __Pyx_GIVEREF(__pyx_v_y);
          PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_10, __pyx_v_y);
          __Pyx_INCREF(__pyx_v_h);
          __Pyx_GIVEREF(__pyx_v_h);
          PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_10, __pyx_v_h);
          __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_20, __pyx_t_21, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
        }
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_14))) || (PyList_CheckExact(__pyx_t_14))) {
          PyObject* sequence = __pyx_t_14;
          Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
          if (unlikely(size != 3)) {
            if (size > 3) __Pyx_RaiseTooManyValuesError(3);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            __PYX_ERR(0, 1005, __pyx_L1_error)
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_20 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_19 = PyTuple_GET_ITEM(sequence, 2); 
          } else {
            __pyx_t_20 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_21 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_19 = PyList_GET_ITEM(sequence, 2); 
          }
          __Pyx_INCREF(__pyx_t_20);
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(__pyx_t_19);
          #else
          __pyx_t_20 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_20);
          __pyx_t_21 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __pyx_t_19 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          #endif
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_3 = PyObject_GetIter(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1005, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
          index = 0; __pyx_t_20 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_20)) goto __pyx_L85_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_20);
          index = 1; __pyx_t_21 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_21)) goto __pyx_L85_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_21);
          index = 2; __pyx_t_19 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_19)) goto __pyx_L85_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_19);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) __PYX_ERR(0, 1005, __pyx_L1_error)
          __pyx_t_6 = NULL;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          goto __pyx_L86_unpacking_done;
          __pyx_L85_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, 1005, __pyx_L1_error)
          __pyx_L86_unpacking_done:;
        }
        __Pyx_DECREF_SET(__pyx_v_my, __pyx_t_20);
        __pyx_t_20 = 0;
        __Pyx_XDECREF_SET(__pyx_v_mcy, __pyx_t_21);
        __pyx_t_21 = 0;
        __Pyx_DECREF_SET(__pyx_v_mh, __pyx_t_19);
        __pyx_t_19 = 0;

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

          /* "renpy/display/render.pyx":1008
 * 
 *                     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":1009
 *                     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":1010
 *                         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":1007
 *                     my, mcy, mh = compute_subline(my, mh, y, h)
 * 
 *                     if mw <= 0 or mh <= 0:             # <<<<<<<<<<<<<<
 *                         mx = None
 *                         my = None
 */
          goto __pyx_L87;
        }

        /* "renpy/display/render.pyx":1012
 *                         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_19 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s_subsurface); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1012, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_19);
          __pyx_t_21 = PyTuple_New(4); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 1012, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_21);
          __Pyx_INCREF(__pyx_v_mcx);
          __Pyx_GIVEREF(__pyx_v_mcx);
          PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_v_mcx);
          __Pyx_INCREF(__pyx_v_mcy);
          __Pyx_GIVEREF(__pyx_v_mcy);
          PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_v_mcy);
          __Pyx_INCREF(__pyx_v_mw);
          __Pyx_GIVEREF(__pyx_v_mw);
          PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_v_mw);
          __Pyx_INCREF(__pyx_v_mh);
          __Pyx_GIVEREF(__pyx_v_mh);
          PyTuple_SET_ITEM(__pyx_t_21, 3, __pyx_v_mh);
          __pyx_t_20 = NULL;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) {
            __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_19);
            if (likely(__pyx_t_20)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
              __Pyx_INCREF(__pyx_t_20);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_19, function);
            }
          }
          __pyx_t_14 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_19, __pyx_t_20, __pyx_t_21) : __Pyx_PyObject_CallOneArg(__pyx_t_19, __pyx_t_21);
          __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1012, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_DECREF_SET(__pyx_v_mask, __pyx_t_14);
          __pyx_t_14 = 0;
        }
        __pyx_L87:;

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

      /* "renpy/display/render.pyx":1014
 *                         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_19 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_add_focus); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 1014, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_19);
      __pyx_t_21 = NULL;
      __pyx_t_10 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_19))) {
        __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_19);
        if (likely(__pyx_t_21)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_19);
          __Pyx_INCREF(__pyx_t_21);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_19, function);
          __pyx_t_10 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_19)) {
        PyObject *__pyx_temp[10] = {__pyx_t_21, __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_14 = __Pyx_PyFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 9+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_19)) {
        PyObject *__pyx_temp[10] = {__pyx_t_21, __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_14 = __Pyx_PyCFunction_FastCall(__pyx_t_19, __pyx_temp+1-__pyx_t_10, 9+__pyx_t_10); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
        __Pyx_GOTREF(__pyx_t_14);
      } else
      #endif
      {
        __pyx_t_20 = PyTuple_New(9+__pyx_t_10); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_20);
        if (__pyx_t_21) {
          __Pyx_GIVEREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_21); __pyx_t_21 = NULL;
        }
        __Pyx_INCREF(__pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_10, __pyx_v_d);
        __Pyx_INCREF(__pyx_v_arg);
        __Pyx_GIVEREF(__pyx_v_arg);
        PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_10, __pyx_v_arg);
        __Pyx_INCREF(__pyx_v_xo);
        __Pyx_GIVEREF(__pyx_v_xo);
        PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_10, __pyx_v_xo);
        __Pyx_INCREF(__pyx_v_yo);
        __Pyx_GIVEREF(__pyx_v_yo);
        PyTuple_SET_ITEM(__pyx_t_20, 3+__pyx_t_10, __pyx_v_yo);
        __Pyx_INCREF(__pyx_v_fw);
        __Pyx_GIVEREF(__pyx_v_fw);
        PyTuple_SET_ITEM(__pyx_t_20, 4+__pyx_t_10, __pyx_v_fw);
        __Pyx_INCREF(__pyx_v_fh);
        __Pyx_GIVEREF(__pyx_v_fh);
        PyTuple_SET_ITEM(__pyx_t_20, 5+__pyx_t_10, __pyx_v_fh);
        __Pyx_INCREF(__pyx_v_mx);
        __Pyx_GIVEREF(__pyx_v_mx);
        PyTuple_SET_ITEM(__pyx_t_20, 6+__pyx_t_10, __pyx_v_mx);
        __Pyx_INCREF(__pyx_v_my);
        __Pyx_GIVEREF(__pyx_v_my);
        PyTuple_SET_ITEM(__pyx_t_20, 7+__pyx_t_10, __pyx_v_my);
        __Pyx_INCREF(__pyx_v_mask);
        __Pyx_GIVEREF(__pyx_v_mask);
        PyTuple_SET_ITEM(__pyx_t_20, 8+__pyx_t_10, __pyx_v_mask);
        __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_19, __pyx_t_20, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1014, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
      }
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

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

    /* "renpy/display/render.pyx":986
 *             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":1016
 *                 rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 * 
 *         rv.depends_on(self)             # <<<<<<<<<<<<<<
 *         rv.alpha = self.alpha
 *         rv.over = self.over
 */
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rv), __pyx_n_s_depends_on); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_19 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_14);
    if (likely(__pyx_t_19)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_19);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_14, function);
    }
  }
  __pyx_t_11 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_19, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_14, ((PyObject *)__pyx_v_self));
  __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
  if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1016, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

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

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

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

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

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

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

  /* "renpy/display/render.pyx":1024
 *         rv.nearest = self.nearest
 * 
 *         rv.mesh = self.mesh             # <<<<<<<<<<<<<<
 *         rv.shaders = self.shaders
 *         rv.uniforms = self.uniforms
 */
  __pyx_t_11 = __pyx_v_self->mesh;
  __Pyx_INCREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __Pyx_GOTREF(__pyx_v_rv->mesh);
  __Pyx_DECREF(__pyx_v_rv->mesh);
  __pyx_v_rv->mesh = __pyx_t_11;
  __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1025
 * 
 *         rv.mesh = self.mesh
 *         rv.shaders = self.shaders             # <<<<<<<<<<<<<<
 *         rv.uniforms = self.uniforms
 *         rv.properties = self.properties
 */
  __pyx_t_11 = __pyx_v_self->shaders;
  __Pyx_INCREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __Pyx_GOTREF(__pyx_v_rv->shaders);
  __Pyx_DECREF(__pyx_v_rv->shaders);
  __pyx_v_rv->shaders = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1026
 *         rv.mesh = self.mesh
 *         rv.shaders = self.shaders
 *         rv.uniforms = self.uniforms             # <<<<<<<<<<<<<<
 *         rv.properties = self.properties
 * 
 */
  __pyx_t_11 = __pyx_v_self->uniforms;
  __Pyx_INCREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __Pyx_GOTREF(__pyx_v_rv->uniforms);
  __Pyx_DECREF(__pyx_v_rv->uniforms);
  __pyx_v_rv->uniforms = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1027
 *         rv.shaders = self.shaders
 *         rv.uniforms = self.uniforms
 *         rv.properties = self.properties             # <<<<<<<<<<<<<<
 * 
 *         rv.text_input = self.text_input
 */
  __pyx_t_11 = __pyx_v_self->properties;
  __Pyx_INCREF(__pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __Pyx_GOTREF(__pyx_v_rv->properties);
  __Pyx_DECREF(__pyx_v_rv->properties);
  __pyx_v_rv->properties = ((PyObject*)__pyx_t_11);
  __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1029
 *         rv.properties = self.properties
 * 
 *         rv.text_input = self.text_input             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_8 = __pyx_v_self->text_input;
  __pyx_v_rv->text_input = __pyx_t_8;

  /* "renpy/display/render.pyx":1031
 *         rv.text_input = self.text_input
 * 
 *         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":884
 *     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_11);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_XDECREF(__pyx_t_22);
  __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_forward);
  __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":1034
 * 
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__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 = __Pyx_PyDict_GetItemStr(__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, 1034, __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, 1034, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("depends_on", 0);

  /* "renpy/display/render.pyx":1041
 *         """
 * 
 *         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 (unlikely(__pyx_t_2)) {

    /* "renpy/display/render.pyx":1042
 * 
 *         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__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1042, __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, 1042, __pyx_L1_error)

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

  /* "renpy/display/render.pyx":1044
 *             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, 1044, __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, 1044, __pyx_L1_error)

  /* "renpy/display/render.pyx":1045
 * 
 *         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, 1045, __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, 1045, __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);
    }
  }
  __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_5, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_6, ((PyObject *)__pyx_v_self));
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1045, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1047
 *         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, 1047, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1048
 * 
 *         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":1049
 *         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, 1049, __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":1048
 * 
 *         if focus:
 *             if self.pass_focuses is None:             # <<<<<<<<<<<<<<
 *                 self.pass_focuses = [ source ]
 *             else:
 */
      goto __pyx_L5;
    }

    /* "renpy/display/render.pyx":1051
 *                 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, 1051, __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, 1051, __pyx_L1_error)
    }
    __pyx_L5:;

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

  /* "renpy/display/render.pyx":1034
 * 
 * 
 *     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_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":1054
 * 
 * 
 *     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;
  Py_ssize_t __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *(*__pyx_t_15)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("kill_cache", 0);

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

    /* "renpy/display/render.pyx":1060
 * 
 *         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":1059
 *         """
 * 
 *         if self.cache_killed:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

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

  /* "renpy/display/render.pyx":1064
 *         self.cache_killed = True
 * 
 *         for i in self.parents:             # <<<<<<<<<<<<<<
 *             i.kill_cache()
 * 
 */
  __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_set_iterator(__pyx_v_self->parents, 1, (&__pyx_t_4), (&__pyx_t_5)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_2);
  __pyx_t_2 = __pyx_t_6;
  __pyx_t_6 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_set_iter_next(__pyx_t_2, __pyx_t_4, &__pyx_t_3, &__pyx_t_6, __pyx_t_5);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1064, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "renpy/display/render.pyx":1065
 * 
 *         for i in self.parents:
 *             i.kill_cache()             # <<<<<<<<<<<<<<
 * 
 *         self.parents.clear()
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_kill_cache); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __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);
      }
    }
    __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1065, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1067
 *             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, 1067, __pyx_L1_error)
  }
  __pyx_t_10 = PySet_Clear(__pyx_v_self->parents); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 1067, __pyx_L1_error)

  /* "renpy/display/render.pyx":1069
 *         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, 1069, __pyx_L1_error)
  }
  __pyx_t_2 = __pyx_v_self->depends_on_list; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1069, __pyx_L1_error)
    #else
    __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1069, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_6);
    __pyx_t_6 = 0;

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

      /* "renpy/display/render.pyx":1071
 *         for i in self.depends_on_list:
 *             if not i.cache_killed:
 *                 i.parents.discard(self)             # <<<<<<<<<<<<<<
 * 
 *         for ro in self.render_of:
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_i, __pyx_n_s_parents); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_discard); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_8, ((PyObject *)__pyx_v_self)) : __Pyx_PyObject_CallOneArg(__pyx_t_9, ((PyObject *)__pyx_v_self));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1071, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

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

    /* "renpy/display/render.pyx":1069
 *         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":1073
 *                 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_4 = 0;
    __pyx_t_12 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_self->render_of); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1073, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1073, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_12)) {
      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_6 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1073, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1073, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1073, __pyx_L1_error)
        #else
        __pyx_t_6 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1073, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        #endif
      }
    } else {
      __pyx_t_6 = __pyx_t_12(__pyx_t_2);
      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, 1073, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_6);
    }
    __Pyx_XDECREF_SET(__pyx_v_ro, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "renpy/display/render.pyx":1074
 * 
 *         for ro in self.render_of:
 *             id_ro = id(ro)             # <<<<<<<<<<<<<<
 * 
 *             cache = render_cache[id_ro]
 */
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, __pyx_v_ro); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1074, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_id_ro, __pyx_t_6);
    __pyx_t_6 = 0;

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

    /* "renpy/display/render.pyx":1077
 * 
 *             cache = render_cache[id_ro]
 *             for k, v in list(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, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = NULL;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    __pyx_t_9 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PySequence_List(__pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1077, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __pyx_t_6; __Pyx_INCREF(__pyx_t_9); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_9)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_6 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 1077, __pyx_L1_error)
      #else
      __pyx_t_6 = PySequence_ITEM(__pyx_t_9, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1077, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
        PyObject* sequence = __pyx_t_6;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1077, __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_13 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_13);
        #else
        __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        #endif
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_14 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1077, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_8)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 1077, __pyx_L1_error)
        __pyx_t_15 = NULL;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L14_unpacking_done;
        __pyx_L13_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_15 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1077, __pyx_L1_error)
        __pyx_L14_unpacking_done:;
      }
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_13);
      __pyx_t_13 = 0;

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

        /* "renpy/display/render.pyx":1079
 *             for k, v in list(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, 1079, __pyx_L1_error)

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

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

    /* "renpy/display/render.pyx":1081
 *                     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, 1081, __pyx_L1_error)
    __pyx_t_11 = ((!__pyx_t_1) != 0);
    if (__pyx_t_11) {

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

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

    /* "renpy/display/render.pyx":1073
 *                 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":1084
 *                 del render_cache[id_ro]
 * 
 *         self.render_of = [ ]             # <<<<<<<<<<<<<<
 *         self.focuses = None
 *         self.pass_focuses = None
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1084, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->render_of);
  __Pyx_DECREF(__pyx_v_self->render_of);
  __pyx_v_self->render_of = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1085
 * 
 *         self.render_of = [ ]
 *         self.focuses = None             # <<<<<<<<<<<<<<
 *         self.pass_focuses = None
 * 
 */
  __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":1086
 *         self.render_of = [ ]
 *         self.focuses = None
 *         self.pass_focuses = None             # <<<<<<<<<<<<<<
 * 
 *     def kill(self):
 */
  __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":1054
 * 
 * 
 *     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_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __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":1088
 *         self.pass_focuses = None
 * 
 *     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":1093
 *         """
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_arg);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mx);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_my);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1093, __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, 1093, __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;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_focus", 0);

  /* "renpy/display/render.pyx":1106
 *         """
 * 
 *         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":1107
 * 
 *         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, 1107, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_mask) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_mask);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1107, __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":1106
 *         """
 * 
 *         if isinstance(mask, Render) and mask is not self:             # <<<<<<<<<<<<<<
 *             self.depends_on(mask)
 * 
 */
  }

  /* "renpy/display/render.pyx":1109
 *             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, 1109, __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":1111
 *         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":1112
 * 
 *         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, 1112, __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":1111
 *         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":1114
 *             self.focuses = [ t ]
 *         else:
 *             self.focuses.append(t)             # <<<<<<<<<<<<<<
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, transform, 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, 1114, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_self->focuses, __pyx_v_t); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 1114, __pyx_L1_error)
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":1093
 *         """
 * 
 *     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_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":1116
 *             self.focuses.append(t)
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, transform, 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        `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        ";
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_transform = 0;
  PyObject *__pyx_v_screen = 0;
  PyObject *__pyx_v_focuses = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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_transform,&__pyx_n_s_screen,&__pyx_n_s_focuses,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        CYTHON_FALLTHROUGH;
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        CYTHON_FALLTHROUGH;
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        CYTHON_FALLTHROUGH;
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        CYTHON_FALLTHROUGH;
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cminx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cminy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 7, 7, 1); __PYX_ERR(0, 1116, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmaxx)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 7, 7, 2); __PYX_ERR(0, 1116, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cmaxy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 7, 7, 3); __PYX_ERR(0, 1116, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transform)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 7, 7, 4); __PYX_ERR(0, 1116, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 7, 7, 5); __PYX_ERR(0, 1116, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_focuses)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 7, 7, 6); __PYX_ERR(0, 1116, __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, 1116, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_cminx = values[0];
    __pyx_v_cminy = values[1];
    __pyx_v_cmaxx = values[2];
    __pyx_v_cmaxy = values[3];
    __pyx_v_transform = values[4];
    __pyx_v_screen = values[5];
    __pyx_v_focuses = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1116, __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_transform, __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_transform, 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_maxx = NULL;
  PyObject *__pyx_v_miny = NULL;
  PyObject *__pyx_v_maxy = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_cx = NULL;
  PyObject *__pyx_v_cy = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_child_transform = 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;
  float __pyx_t_19;
  float __pyx_t_20;
  int __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_screen);

  /* "renpy/display/render.pyx":1136
 *         """
 * 
 *         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":1137
 * 
 *         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":1136
 *         """
 * 
 *         if self.focus_screen is not None:             # <<<<<<<<<<<<<<
 *             screen = self.focus_screen
 * 
 */
  }

  /* "renpy/display/render.pyx":1139
 *             screen = self.focus_screen
 * 
 *         if self.modal:             # <<<<<<<<<<<<<<
 *             focuses[:] = [ ]
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->modal); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1139, __pyx_L1_error)
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1140
 * 
 *         if self.modal:
 *             focuses[:] = [ ]             # <<<<<<<<<<<<<<
 * 
 *         if self.focuses:
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetSlice(__pyx_v_focuses, __pyx_t_3, 0, 0, NULL, NULL, &__pyx_slice_, 0, 0, 1) < 0) __PYX_ERR(0, 1140, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1139
 *             screen = self.focus_screen
 * 
 *         if self.modal:             # <<<<<<<<<<<<<<
 *             focuses[:] = [ ]
 * 
 */
  }

  /* "renpy/display/render.pyx":1142
 *             focuses[:] = [ ]
 * 
 *         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":1144
 *         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, 1144, __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, 1144, __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, 1144, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 9)) {
          if (size > 9) __Pyx_RaiseTooManyValuesError(9);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1144, __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, 1144, __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, 1144, __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_L8_unpacking_failed;
          __Pyx_GOTREF(item);
          *(temps[index]) = item;
        }
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 9) < 0) __PYX_ERR(0, 1144, __pyx_L1_error)
        __pyx_t_16 = NULL;
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        goto __pyx_L9_unpacking_done;
        __pyx_L8_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, 1144, __pyx_L1_error)
        __pyx_L9_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":1146
 *             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":1147
 * 
 *                 if xo is None:
 *                     focuses.append(renpy.display.focus.Focus(d, arg, None, None, None, None, screen))             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_renpy); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1147, __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, 1147, __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, 1147, __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, 1147, __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, 1147, __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, 1147, __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, 1147, __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, 1147, __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, 1147, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "renpy/display/render.pyx":1148
 *                 if xo is None:
 *                     focuses.append(renpy.display.focus.Focus(d, arg, None, None, None, None, screen))
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 x1, y1 = transform.transform(xo, yo)
 */
        goto __pyx_L6_continue;

        /* "renpy/display/render.pyx":1146
 *             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":1150
 *                     continue
 * 
 *                 x1, y1 = transform.transform(xo, yo)             # <<<<<<<<<<<<<<
 *                 x2, y2 = transform.transform(xo + w, yo + h)
 * 
 */
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_transform, __pyx_n_s_transform); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1150, __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, 1150, __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, 1150, __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, 1150, __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, 1150, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1150, __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, 1150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1150, __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, 1150, __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_L11_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_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_14);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1150, __pyx_L1_error)
        __pyx_t_16 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_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, 1150, __pyx_L1_error)
        __pyx_L12_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":1151
 * 
 *                 x1, y1 = transform.transform(xo, yo)
 *                 x2, y2 = transform.transform(xo + w, yo + h)             # <<<<<<<<<<<<<<
 * 
 *                 minx = min(x1, x2)
 */
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_transform, __pyx_n_s_transform); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1151, __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, 1151, __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, 1151, __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, 1151, __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, 1151, __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, 1151, __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, 1151, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1151, __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, 1151, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1151, __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, 1151, __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_L13_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_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1151, __pyx_L1_error)
        __pyx_t_16 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L14_unpacking_done;
        __pyx_L13_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, 1151, __pyx_L1_error)
        __pyx_L14_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":1153
 *                 x2, y2 = transform.transform(xo + w, yo + h)
 * 
 *                 minx = min(x1, x2)             # <<<<<<<<<<<<<<
 *                 maxx = max(x1, x2)
 *                 miny = min(y1, y2)
 */
      __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, 1153, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1153, __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_XDECREF_SET(__pyx_v_minx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1154
 * 
 *                 minx = min(x1, x2)
 *                 maxx = max(x1, x2)             # <<<<<<<<<<<<<<
 *                 miny = min(y1, y2)
 *                 maxy = max(y1, y2)
 */
      __Pyx_INCREF(__pyx_v_x2);
      __pyx_t_5 = __pyx_v_x2;
      __Pyx_INCREF(__pyx_v_x1);
      __pyx_t_14 = __pyx_v_x1;
      __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, 1154, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1154, __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_XDECREF_SET(__pyx_v_maxx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1155
 *                 minx = min(x1, x2)
 *                 maxx = max(x1, x2)
 *                 miny = min(y1, y2)             # <<<<<<<<<<<<<<
 *                 maxy = max(y1, y2)
 * 
 */
      __Pyx_INCREF(__pyx_v_y2);
      __pyx_t_5 = __pyx_v_y2;
      __Pyx_INCREF(__pyx_v_y1);
      __pyx_t_10 = __pyx_v_y1;
      __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, 1155, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1155, __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_XDECREF_SET(__pyx_v_miny, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1156
 *                 maxx = max(x1, x2)
 *                 miny = min(y1, y2)
 *                 maxy = max(y1, y2)             # <<<<<<<<<<<<<<
 * 
 *                 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, 1156, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1156, __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_XDECREF_SET(__pyx_v_maxy, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1158
 *                 maxy = max(y1, y2)
 * 
 *                 minx = max(minx, cminx)             # <<<<<<<<<<<<<<
 *                 maxx = min(maxx, cmaxx)
 *                 miny = max(miny, cminy)
 */
      __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, 1158, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1158, __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":1159
 * 
 *                 minx = max(minx, cminx)
 *                 maxx = min(maxx, cmaxx)             # <<<<<<<<<<<<<<
 *                 miny = max(miny, cminy)
 *                 maxy = min(maxy, cmaxy)
 */
      __Pyx_INCREF(__pyx_v_cmaxx);
      __pyx_t_5 = __pyx_v_cmaxx;
      __Pyx_INCREF(__pyx_v_maxx);
      __pyx_t_14 = __pyx_v_maxx;
      __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, 1159, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1159, __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_maxx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1160
 *                 minx = max(minx, cminx)
 *                 maxx = min(maxx, cmaxx)
 *                 miny = max(miny, cminy)             # <<<<<<<<<<<<<<
 *                 maxy = min(maxy, cmaxy)
 * 
 */
      __Pyx_INCREF(__pyx_v_cminy);
      __pyx_t_5 = __pyx_v_cminy;
      __Pyx_INCREF(__pyx_v_miny);
      __pyx_t_10 = __pyx_v_miny;
      __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, 1160, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1160, __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_miny, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1161
 *                 maxx = min(maxx, cmaxx)
 *                 miny = max(miny, cminy)
 *                 maxy = min(maxy, cmaxy)             # <<<<<<<<<<<<<<
 * 
 *                 if maxx <= minx:
 */
      __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, 1161, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1161, __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":1163
 *                 maxy = min(maxy, cmaxy)
 * 
 *                 if maxx <= minx:             # <<<<<<<<<<<<<<
 *                     continue
 *                 if maxy <= miny:
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_maxx, __pyx_v_minx, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1163, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1163, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "renpy/display/render.pyx":1164
 * 
 *                 if maxx <= minx:
 *                     continue             # <<<<<<<<<<<<<<
 *                 if maxy <= miny:
 *                     continue
 */
        goto __pyx_L6_continue;

        /* "renpy/display/render.pyx":1163
 *                 maxy = min(maxy, cmaxy)
 * 
 *                 if maxx <= minx:             # <<<<<<<<<<<<<<
 *                     continue
 *                 if maxy <= miny:
 */
      }

      /* "renpy/display/render.pyx":1165
 *                 if maxx <= minx:
 *                     continue
 *                 if maxy <= miny:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_5 = PyObject_RichCompare(__pyx_v_maxy, __pyx_v_miny, Py_LE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1165, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1165, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (__pyx_t_1) {

        /* "renpy/display/render.pyx":1166
 *                     continue
 *                 if maxy <= miny:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))
 */
        goto __pyx_L6_continue;

        /* "renpy/display/render.pyx":1165
 *                 if maxx <= minx:
 *                     continue
 *                 if maxy <= miny:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      }

      /* "renpy/display/render.pyx":1168
 *                     continue
 * 
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))             # <<<<<<<<<<<<<<
 * 
 *         if self.xclipping or self.yclipping:
 */
      __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_renpy); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1168, __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, 1168, __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, 1168, __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, 1168, __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, 1168, __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, 1168, __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, 1168, __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, 1168, __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, 1168, __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, 1168, __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, 1168, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1144
 *         if self.focuses:
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
      __pyx_L6_continue:;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1142
 *             focuses[:] = [ ]
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 */
  }

  /* "renpy/display/render.pyx":1170
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))
 * 
 *         if self.xclipping or self.yclipping:             # <<<<<<<<<<<<<<
 * 
 *             x1, y1 = transform.transform(0, 0)
 */
  __pyx_t_2 = (__pyx_v_self->xclipping != 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L18_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_self->yclipping != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L18_bool_binop_done:;
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1172
 *         if self.xclipping or self.yclipping:
 * 
 *             x1, y1 = transform.transform(0, 0)             # <<<<<<<<<<<<<<
 *             x2, y2 = transform.transform(self.width, self.height)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_transform, __pyx_n_s_transform); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1172, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1172, __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_14 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_14);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1172, __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_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1172, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_16(__pyx_t_11); if (unlikely(!__pyx_t_3)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_14 = __pyx_t_16(__pyx_t_11); if (unlikely(!__pyx_t_14)) goto __pyx_L20_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1172, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L21_unpacking_done;
      __pyx_L20_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1172, __pyx_L1_error)
      __pyx_L21_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_x1, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_y1, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "renpy/display/render.pyx":1173
 * 
 *             x1, y1 = transform.transform(0, 0)
 *             x2, y2 = transform.transform(self.width, self.height)             # <<<<<<<<<<<<<<
 * 
 *             if self.xclipping:
 */
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_transform, __pyx_n_s_transform); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1173, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = NULL;
    __pyx_t_17 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_12);
        __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_12, __pyx_t_3, __pyx_t_11};
      __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, 1173, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_3, __pyx_t_11};
      __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, 1173, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_10 = PyTuple_New(2+__pyx_t_17); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_17, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_17, __pyx_t_11);
      __pyx_t_3 = 0;
      __pyx_t_11 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1173, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        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_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, 1173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1173, __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_11 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1173, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_16(__pyx_t_11); if (unlikely(!__pyx_t_14)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_10 = __pyx_t_16(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1173, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L23_unpacking_done;
      __pyx_L22_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      __PYX_ERR(0, 1173, __pyx_L1_error)
      __pyx_L23_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":1175
 *             x2, y2 = transform.transform(self.width, self.height)
 * 
 *             if self.xclipping:             # <<<<<<<<<<<<<<
 *                 minx = min(x1, x2)
 *                 maxx = max(x1, x2)
 */
    __pyx_t_1 = (__pyx_v_self->xclipping != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":1176
 * 
 *             if self.xclipping:
 *                 minx = min(x1, x2)             # <<<<<<<<<<<<<<
 *                 maxx = max(x1, x2)
 *                 cminx = max(minx, cminx)
 */
      __Pyx_INCREF(__pyx_v_x2);
      __pyx_t_5 = __pyx_v_x2;
      __Pyx_INCREF(__pyx_v_x1);
      __pyx_t_10 = __pyx_v_x1;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1176, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1176, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_XDECREF_SET(__pyx_v_minx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1177
 *             if self.xclipping:
 *                 minx = min(x1, x2)
 *                 maxx = max(x1, x2)             # <<<<<<<<<<<<<<
 *                 cminx = max(minx, cminx)
 *                 cmaxx = min(maxx, cmaxx)
 */
      __Pyx_INCREF(__pyx_v_x2);
      __pyx_t_5 = __pyx_v_x2;
      __Pyx_INCREF(__pyx_v_x1);
      __pyx_t_14 = __pyx_v_x1;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1177, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1177, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_XDECREF_SET(__pyx_v_maxx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1178
 *                 minx = min(x1, x2)
 *                 maxx = max(x1, x2)
 *                 cminx = max(minx, cminx)             # <<<<<<<<<<<<<<
 *                 cmaxx = 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_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1178, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1178, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_cminx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1179
 *                 maxx = max(x1, x2)
 *                 cminx = max(minx, cminx)
 *                 cmaxx = min(maxx, cmaxx)             # <<<<<<<<<<<<<<
 * 
 *             if self.yclipping:
 */
      __Pyx_INCREF(__pyx_v_cmaxx);
      __pyx_t_5 = __pyx_v_cmaxx;
      __Pyx_INCREF(__pyx_v_maxx);
      __pyx_t_14 = __pyx_v_maxx;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1179, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1179, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_cmaxx, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1175
 *             x2, y2 = transform.transform(self.width, self.height)
 * 
 *             if self.xclipping:             # <<<<<<<<<<<<<<
 *                 minx = min(x1, x2)
 *                 maxx = max(x1, x2)
 */
    }

    /* "renpy/display/render.pyx":1181
 *                 cmaxx = min(maxx, cmaxx)
 * 
 *             if self.yclipping:             # <<<<<<<<<<<<<<
 *                 miny = min(y1, y2)
 *                 maxy = max(y1, y2)
 */
    __pyx_t_1 = (__pyx_v_self->yclipping != 0);
    if (__pyx_t_1) {

      /* "renpy/display/render.pyx":1182
 * 
 *             if self.yclipping:
 *                 miny = min(y1, y2)             # <<<<<<<<<<<<<<
 *                 maxy = max(y1, y2)
 *                 cminy = max(miny, cminy)
 */
      __Pyx_INCREF(__pyx_v_y2);
      __pyx_t_5 = __pyx_v_y2;
      __Pyx_INCREF(__pyx_v_y1);
      __pyx_t_10 = __pyx_v_y1;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1182, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1182, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_XDECREF_SET(__pyx_v_miny, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1183
 *             if self.yclipping:
 *                 miny = min(y1, y2)
 *                 maxy = max(y1, y2)             # <<<<<<<<<<<<<<
 *                 cminy = max(miny, cminy)
 *                 cmaxy = min(maxy, cmaxy)
 */
      __Pyx_INCREF(__pyx_v_y2);
      __pyx_t_5 = __pyx_v_y2;
      __Pyx_INCREF(__pyx_v_y1);
      __pyx_t_14 = __pyx_v_y1;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1183, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1183, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_XDECREF_SET(__pyx_v_maxy, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1184
 *                 miny = min(y1, y2)
 *                 maxy = max(y1, y2)
 *                 cminy = max(miny, cminy)             # <<<<<<<<<<<<<<
 *                 cmaxy = min(maxy, cmaxy)
 * 
 */
      __Pyx_INCREF(__pyx_v_cminy);
      __pyx_t_5 = __pyx_v_cminy;
      __Pyx_INCREF(__pyx_v_miny);
      __pyx_t_10 = __pyx_v_miny;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_10, Py_GT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1184, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1184, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_cminy, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1185
 *                 maxy = max(y1, y2)
 *                 cminy = max(miny, cminy)
 *                 cmaxy = min(maxy, cmaxy)             # <<<<<<<<<<<<<<
 * 
 *         for child, cx, cy, focus, main in self.children:
 */
      __Pyx_INCREF(__pyx_v_cmaxy);
      __pyx_t_5 = __pyx_v_cmaxy;
      __Pyx_INCREF(__pyx_v_maxy);
      __pyx_t_14 = __pyx_v_maxy;
      __pyx_t_11 = PyObject_RichCompare(__pyx_t_5, __pyx_t_14, Py_LT); __Pyx_XGOTREF(__pyx_t_11); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1185, __pyx_L1_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1185, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 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_cmaxy, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":1181
 *                 cmaxx = min(maxx, cmaxx)
 * 
 *             if self.yclipping:             # <<<<<<<<<<<<<<
 *                 miny = min(y1, y2)
 *                 maxy = max(y1, y2)
 */
    }

    /* "renpy/display/render.pyx":1170
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny, screen))
 * 
 *         if self.xclipping or self.yclipping:             # <<<<<<<<<<<<<<
 * 
 *             x1, y1 = transform.transform(0, 0)
 */
  }

  /* "renpy/display/render.pyx":1187
 *                 cmaxy = min(maxy, cmaxy)
 * 
 *         for child, cx, cy, focus, main in self.children:             # <<<<<<<<<<<<<<
 * 
 *             if not isinstance(child, Render):
 */
  if (unlikely(__pyx_v_self->children == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    __PYX_ERR(0, 1187, __pyx_L1_error)
  }
  __pyx_t_5 = __pyx_v_self->children; __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    __pyx_t_10 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_10); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1187, __pyx_L1_error)
    #else
    __pyx_t_10 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
      PyObject* sequence = __pyx_t_10;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1187, __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_3 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_12 = 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_3 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_12 = 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_3);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_13);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_14,&__pyx_t_11,&__pyx_t_3,&__pyx_t_12,&__pyx_t_13};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1187, __pyx_L1_error)
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_14,&__pyx_t_11,&__pyx_t_3,&__pyx_t_12,&__pyx_t_13};
      __pyx_t_9 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1187, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 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_L28_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_9), 5) < 0) __PYX_ERR(0, 1187, __pyx_L1_error)
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L29_unpacking_done;
      __pyx_L28_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, 1187, __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_cx, __pyx_t_11);
    __pyx_t_11 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cy, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_13);
    __pyx_t_13 = 0;

    /* "renpy/display/render.pyx":1189
 *         for child, cx, cy, focus, main in self.children:
 * 
 *             if not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_child, __pyx_ptype_5renpy_7display_6render_Render); 
    __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1190
 * 
 *             if not isinstance(child, Render):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             child_transform = transform
 */
      goto __pyx_L26_continue;

      /* "renpy/display/render.pyx":1189
 *         for child, cx, cy, focus, main in self.children:
 * 
 *             if not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":1192
 *                 continue
 * 
 *             child_transform = transform             # <<<<<<<<<<<<<<
 * 
 *             if (cx or cy):
 */
    __Pyx_INCREF(__pyx_v_transform);
    __Pyx_XDECREF_SET(__pyx_v_child_transform, __pyx_v_transform);

    /* "renpy/display/render.pyx":1194
 *             child_transform = transform
 * 
 *             if (cx or cy):             # <<<<<<<<<<<<<<
 *                 child_transform = child_transform * Matrix.coffset(cx, cy, 0)
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_cx); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1194, __pyx_L1_error)
    if (!__pyx_t_1) {
    } else {
      __pyx_t_2 = __pyx_t_1;
      goto __pyx_L32_bool_binop_done;
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_cy); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1194, __pyx_L1_error)
    __pyx_t_2 = __pyx_t_1;
    __pyx_L32_bool_binop_done:;
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1195
 * 
 *             if (cx or cy):
 *                 child_transform = child_transform * Matrix.coffset(cx, cy, 0)             # <<<<<<<<<<<<<<
 * 
 *             if (self.reverse is not None) and (self.reverse is not IDENTITY):
 */
      __pyx_t_19 = __pyx_PyFloat_AsFloat(__pyx_v_cx); if (unlikely((__pyx_t_19 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1195, __pyx_L1_error)
      __pyx_t_20 = __pyx_PyFloat_AsFloat(__pyx_v_cy); if (unlikely((__pyx_t_20 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 1195, __pyx_L1_error)
      __pyx_t_10 = ((PyObject *)__pyx_vtabptr_5renpy_7display_6matrix_Matrix->coffset(__pyx_t_19, __pyx_t_20, 0.0)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_13 = PyNumber_Multiply(__pyx_v_child_transform, __pyx_t_10); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1195, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF_SET(__pyx_v_child_transform, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":1194
 *             child_transform = transform
 * 
 *             if (cx or cy):             # <<<<<<<<<<<<<<
 *                 child_transform = child_transform * Matrix.coffset(cx, cy, 0)
 * 
 */
    }

    /* "renpy/display/render.pyx":1197
 *                 child_transform = child_transform * Matrix.coffset(cx, cy, 0)
 * 
 *             if (self.reverse is not None) and (self.reverse is not IDENTITY):             # <<<<<<<<<<<<<<
 *                 child_transform = child_transform * self.reverse
 * 
 */
    __pyx_t_1 = (((PyObject *)__pyx_v_self->reverse) != Py_None);
    __pyx_t_21 = (__pyx_t_1 != 0);
    if (__pyx_t_21) {
    } else {
      __pyx_t_2 = __pyx_t_21;
      goto __pyx_L35_bool_binop_done;
    }
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_21 = (((PyObject *)__pyx_v_self->reverse) != __pyx_t_13);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_1 = (__pyx_t_21 != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L35_bool_binop_done:;
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1198
 * 
 *             if (self.reverse is not None) and (self.reverse is not IDENTITY):
 *                 child_transform = child_transform * self.reverse             # <<<<<<<<<<<<<<
 * 
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, child_transform, screen, focuses)
 */
      __pyx_t_13 = PyNumber_Multiply(__pyx_v_child_transform, ((PyObject *)__pyx_v_self->reverse)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1198, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF_SET(__pyx_v_child_transform, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":1197
 *                 child_transform = child_transform * Matrix.coffset(cx, cy, 0)
 * 
 *             if (self.reverse is not None) and (self.reverse is not IDENTITY):             # <<<<<<<<<<<<<<
 *                 child_transform = child_transform * self.reverse
 * 
 */
    }

    /* "renpy/display/render.pyx":1200
 *                 child_transform = child_transform * self.reverse
 * 
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, child_transform, screen, focuses)             # <<<<<<<<<<<<<<
 * 
 *         if self.pass_focuses:
 */
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_take_focuses); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1200, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_12 = NULL;
    __pyx_t_17 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_17 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[8] = {__pyx_t_12, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_child_transform, __pyx_v_screen, __pyx_v_focuses};
      __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
      PyObject *__pyx_temp[8] = {__pyx_t_12, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_child_transform, __pyx_v_screen, __pyx_v_focuses};
      __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_13);
    } else
    #endif
    {
      __pyx_t_3 = PyTuple_New(7+__pyx_t_17); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cminx);
      __Pyx_GIVEREF(__pyx_v_cminx);
      PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_17, __pyx_v_cminx);
      __Pyx_INCREF(__pyx_v_cminy);
      __Pyx_GIVEREF(__pyx_v_cminy);
      PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_17, __pyx_v_cminy);
      __Pyx_INCREF(__pyx_v_cmaxx);
      __Pyx_GIVEREF(__pyx_v_cmaxx);
      PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_17, __pyx_v_cmaxx);
      __Pyx_INCREF(__pyx_v_cmaxy);
      __Pyx_GIVEREF(__pyx_v_cmaxy);
      PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_17, __pyx_v_cmaxy);
      __Pyx_INCREF(__pyx_v_child_transform);
      __Pyx_GIVEREF(__pyx_v_child_transform);
      PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_17, __pyx_v_child_transform);
      __Pyx_INCREF(__pyx_v_screen);
      __Pyx_GIVEREF(__pyx_v_screen);
      PyTuple_SET_ITEM(__pyx_t_3, 5+__pyx_t_17, __pyx_v_screen);
      __Pyx_INCREF(__pyx_v_focuses);
      __Pyx_GIVEREF(__pyx_v_focuses);
      PyTuple_SET_ITEM(__pyx_t_3, 6+__pyx_t_17, __pyx_v_focuses);
      __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1200, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "renpy/display/render.pyx":1187
 *                 cmaxy = min(maxy, cmaxy)
 * 
 *         for child, cx, cy, focus, main in self.children:             # <<<<<<<<<<<<<<
 * 
 *             if not isinstance(child, Render):
 */
    __pyx_L26_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/display/render.pyx":1202
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, child_transform, screen, focuses)
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, transform, screen, focuses)
 */
  __pyx_t_2 = (__pyx_v_self->pass_focuses != Py_None)&&(PyList_GET_SIZE(__pyx_v_self->pass_focuses) != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1203
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, transform, screen, focuses)
 * 
 */
    if (unlikely(__pyx_v_self->pass_focuses == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
      __PYX_ERR(0, 1203, __pyx_L1_error)
    }
    __pyx_t_5 = __pyx_v_self->pass_focuses; __Pyx_INCREF(__pyx_t_5); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_5)) break;
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_13 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_4); __Pyx_INCREF(__pyx_t_13); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 1203, __pyx_L1_error)
      #else
      __pyx_t_13 = PySequence_ITEM(__pyx_t_5, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      #endif
      __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_13);
      __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":1204
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, transform, screen, focuses)             # <<<<<<<<<<<<<<
 * 
 *     def focus_at_point(self, x, y, screen): #@DuplicatedSignature
 */
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_take_focuses); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1204, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_3 = NULL;
      __pyx_t_17 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_17 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[8] = {__pyx_t_3, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_transform, __pyx_v_screen, __pyx_v_focuses};
        __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_13);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[8] = {__pyx_t_3, __pyx_v_cminx, __pyx_v_cminy, __pyx_v_cmaxx, __pyx_v_cmaxy, __pyx_v_transform, __pyx_v_screen, __pyx_v_focuses};
        __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_17, 7+__pyx_t_17); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_GOTREF(__pyx_t_13);
      } else
      #endif
      {
        __pyx_t_12 = PyTuple_New(7+__pyx_t_17); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        if (__pyx_t_3) {
          __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL;
        }
        __Pyx_INCREF(__pyx_v_cminx);
        __Pyx_GIVEREF(__pyx_v_cminx);
        PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_17, __pyx_v_cminx);
        __Pyx_INCREF(__pyx_v_cminy);
        __Pyx_GIVEREF(__pyx_v_cminy);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_17, __pyx_v_cminy);
        __Pyx_INCREF(__pyx_v_cmaxx);
        __Pyx_GIVEREF(__pyx_v_cmaxx);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_17, __pyx_v_cmaxx);
        __Pyx_INCREF(__pyx_v_cmaxy);
        __Pyx_GIVEREF(__pyx_v_cmaxy);
        PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_17, __pyx_v_cmaxy);
        __Pyx_INCREF(__pyx_v_transform);
        __Pyx_GIVEREF(__pyx_v_transform);
        PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_17, __pyx_v_transform);
        __Pyx_INCREF(__pyx_v_screen);
        __Pyx_GIVEREF(__pyx_v_screen);
        PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_17, __pyx_v_screen);
        __Pyx_INCREF(__pyx_v_focuses);
        __Pyx_GIVEREF(__pyx_v_focuses);
        PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_17, __pyx_v_focuses);
        __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1204, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":1203
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, transform, screen, focuses)
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1202
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, child_transform, screen, focuses)
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, transform, screen, focuses)
 */
  }

  /* "renpy/display/render.pyx":1116
 *             self.focuses.append(t)
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, transform, 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_maxx);
  __Pyx_XDECREF(__pyx_v_miny);
  __Pyx_XDECREF(__pyx_v_maxy);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_cx);
  __Pyx_XDECREF(__pyx_v_cy);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_child_transform);
  __Pyx_XDECREF(__pyx_v_cminx);
  __Pyx_XDECREF(__pyx_v_cminy);
  __Pyx_XDECREF(__pyx_v_cmaxx);
  __Pyx_XDECREF(__pyx_v_cmaxy);
  __Pyx_XDECREF(__pyx_v_screen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1206
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, transform, 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("focus_at_point", 1, 3, 3, 1); __PYX_ERR(0, 1206, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_screen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("focus_at_point", 1, 3, 3, 2); __PYX_ERR(0, 1206, __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, 1206, __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, 1206, __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 *);
  int __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("focus_at_point", 0);
  __Pyx_INCREF(__pyx_v_screen);

  /* "renpy/display/render.pyx":1211
 *         """
 * 
 *         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":1212
 * 
 *         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":1211
 *         """
 * 
 *         if self.focus_screen is not None:             # <<<<<<<<<<<<<<
 *             screen = self.focus_screen
 * 
 */
  }

  /* "renpy/display/render.pyx":1214
 *             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":1215
 * 
 *         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, 1215, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1215, __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, 1215, __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, 1215, __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, 1215, __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":1216
 *         if self.xclipping:
 *             if x < 0 or x >= self.width:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         if self.yclipping:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "renpy/display/render.pyx":1215
 * 
 *         if self.xclipping:
 *             if x < 0 or x >= self.width:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "renpy/display/render.pyx":1214
 *             screen = self.focus_screen
 * 
 *         if self.xclipping:             # <<<<<<<<<<<<<<
 *             if x < 0 or x >= self.width:
 *                 return None
 */
  }

  /* "renpy/display/render.pyx":1218
 *                 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":1219
 * 
 *         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, 1219, __pyx_L1_error)
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1219, __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, 1219, __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, 1219, __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, 1219, __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":1220
 *         if self.yclipping:
 *             if y < 0 or y >= self.height:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         if self.operation == IMAGEDISSOLVE:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "renpy/display/render.pyx":1219
 * 
 *         if self.yclipping:
 *             if y < 0 or y >= self.height:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "renpy/display/render.pyx":1218
 *                 return None
 * 
 *         if self.yclipping:             # <<<<<<<<<<<<<<
 *             if y < 0 or y >= self.height:
 *                 return None
 */
  }

  /* "renpy/display/render.pyx":1222
 *                 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, 1222, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_IMAGEDISSOLVE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1222, __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, 1222, __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, 1222, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1223
 * 
 *         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, 1223, __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, 1223, __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, 1223, __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, 1223, __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, 1223, __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, 1223, __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, 1223, __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, 1223, __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, 1223, __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":1224
 *         if self.operation == IMAGEDISSOLVE:
 *             if not self.children[0][0].is_pixel_opaque(x, y):
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         rv = None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;

      /* "renpy/display/render.pyx":1223
 * 
 *         if self.operation == IMAGEDISSOLVE:
 *             if not self.children[0][0].is_pixel_opaque(x, y):             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    }

    /* "renpy/display/render.pyx":1222
 *                 return None
 * 
 *         if self.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 *             if not self.children[0][0].is_pixel_opaque(x, y):
 *                 return None
 */
  }

  /* "renpy/display/render.pyx":1226
 *                 return None
 * 
 *         rv = None             # <<<<<<<<<<<<<<
 * 
 *         if self.focuses:
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_rv = Py_None;

  /* "renpy/display/render.pyx":1228
 *         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":1229
 * 
 *         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, 1229, __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, 1229, __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, 1229, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 9)) {
          if (size > 9) __Pyx_RaiseTooManyValuesError(9);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1229, __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, 1229, __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, 1229, __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, 1229, __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, 1229, __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":1231
 *             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":1232
 * 
 *                 if xo is None:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 elif mx is not None:
 */
        goto __pyx_L15_continue;

        /* "renpy/display/render.pyx":1231
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      }

      /* "renpy/display/render.pyx":1234
 *                     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":1235
 * 
 *                 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, 1235, __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":1236
 *                 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, 1236, __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":1238
 *                     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, 1238, __pyx_L1_error)
        if (__pyx_t_1) {

          /* "renpy/display/render.pyx":1239
 * 
 *                     if self.forward:
 *                         cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *                     if isinstance(mask, Render):
 */
          __pyx_t_15 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->forward), __pyx_n_s_transform); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1239, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_15);
          __pyx_t_14 = NULL;
          __pyx_t_6 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_15))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_15, function);
              __pyx_t_6 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_15)) {
            PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1239, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_15)) {
            PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_15, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1239, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 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, 1239, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            if (__pyx_t_14) {
              __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __pyx_t_14 = 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_15, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1239, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
            PyObject* sequence = __pyx_t_4;
            Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
            if (unlikely(size != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 1239, __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_13 = PyTuple_GET_ITEM(sequence, 1); 
            } else {
              __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
              __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
            }
            __Pyx_INCREF(__pyx_t_15);
            __Pyx_INCREF(__pyx_t_13);
            #else
            __pyx_t_15 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1239, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1239, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_13);
            #endif
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          } else {
            Py_ssize_t index = -1;
            __pyx_t_14 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1239, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
            __pyx_t_17 = Py_TYPE(__pyx_t_14)->tp_iternext;
            index = 0; __pyx_t_15 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_15)) goto __pyx_L21_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_15);
            index = 1; __pyx_t_13 = __pyx_t_17(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L21_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_13);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_14), 2) < 0) __PYX_ERR(0, 1239, __pyx_L1_error)
            __pyx_t_17 = NULL;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            goto __pyx_L22_unpacking_done;
            __pyx_L21_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __pyx_t_17 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            __PYX_ERR(0, 1239, __pyx_L1_error)
            __pyx_L22_unpacking_done:;
          }
          __Pyx_DECREF_SET(__pyx_v_cx, __pyx_t_15);
          __pyx_t_15 = 0;
          __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_13);
          __pyx_t_13 = 0;

          /* "renpy/display/render.pyx":1238
 *                     cy = y - my
 * 
 *                     if self.forward:             # <<<<<<<<<<<<<<
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 */
        }

        /* "renpy/display/render.pyx":1241
 *                         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":1242
 * 
 *                     if isinstance(mask, Render):
 *                         if mask.is_pixel_opaque(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 *                     else:
 */
          __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_mask, __pyx_n_s_is_pixel_opaque); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1242, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_15 = NULL;
          __pyx_t_6 = 0;
          if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_13))) {
            __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_13);
            if (likely(__pyx_t_15)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
              __Pyx_INCREF(__pyx_t_15);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_13, function);
              __pyx_t_6 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_13)) {
            PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1242, __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_13)) {
            PyObject *__pyx_temp[3] = {__pyx_t_15, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1242, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else
          #endif
          {
            __pyx_t_14 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1242, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_14);
            if (__pyx_t_15) {
              __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); __pyx_t_15 = NULL;
            }
            __Pyx_INCREF(__pyx_v_cx);
            __Pyx_GIVEREF(__pyx_v_cx);
            PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_6, __pyx_v_cx);
            __Pyx_INCREF(__pyx_v_cy);
            __Pyx_GIVEREF(__pyx_v_cy);
            PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_6, __pyx_v_cy);
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1242, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1242, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_2) {

            /* "renpy/display/render.pyx":1243
 *                     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, 1243, __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":1242
 * 
 *                     if isinstance(mask, Render):
 *                         if mask.is_pixel_opaque(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 *                     else:
 */
          }

          /* "renpy/display/render.pyx":1241
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 *                     if isinstance(mask, Render):             # <<<<<<<<<<<<<<
 *                         if mask.is_pixel_opaque(cx, cy):
 *                             rv = d, arg, screen
 */
          goto __pyx_L23;
        }

        /* "renpy/display/render.pyx":1245
 *                             rv = d, arg, screen
 *                     else:
 *                         if mask(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 * 
 */
        /*else*/ {
          __Pyx_INCREF(__pyx_v_mask);
          __pyx_t_13 = __pyx_v_mask; __pyx_t_14 = NULL;
          __pyx_t_6 = 0;
          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);
              __pyx_t_6 = 1;
            }
          }
          #if CYTHON_FAST_PYCALL
          if (PyFunction_Check(__pyx_t_13)) {
            PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1245, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else
          #endif
          #if CYTHON_FAST_PYCCALL
          if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) {
            PyObject *__pyx_temp[3] = {__pyx_t_14, __pyx_v_cx, __pyx_v_cy};
            __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1245, __pyx_L1_error)
            __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 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, 1245, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_15);
            if (__pyx_t_14) {
              __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); __pyx_t_14 = 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_13, __pyx_t_15, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1245, __pyx_L1_error)
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
          }
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1245, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (__pyx_t_2) {

            /* "renpy/display/render.pyx":1246
 *                     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, 1246, __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":1245
 *                             rv = d, arg, screen
 *                     else:
 *                         if mask(cx, cy):             # <<<<<<<<<<<<<<
 *                             rv = d, arg, screen
 * 
 */
          }
        }
        __pyx_L23:;

        /* "renpy/display/render.pyx":1234
 *                     continue
 * 
 *                 elif mx is not None:             # <<<<<<<<<<<<<<
 *                     cx = x - mx
 *                     cy = y - my
 */
        goto __pyx_L19;
      }

      /* "renpy/display/render.pyx":1248
 *                             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, 1248, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_13 = PyNumber_Add(__pyx_v_xo, __pyx_v_w); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1248, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1248, __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_L26_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, 1248, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_13 = PyNumber_Add(__pyx_v_yo, __pyx_v_h); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 1248, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_y, __pyx_t_13, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1248, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1248, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_2 = __pyx_t_1;
      __pyx_L26_bool_binop_done:;
      if (__pyx_t_2) {

        /* "renpy/display/render.pyx":1249
 * 
 *                 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, 1249, __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":1248
 *                             rv = d, arg, screen
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:             # <<<<<<<<<<<<<<
 *                     rv = d, arg, screen
 * 
 */
      }
      __pyx_L19:;

      /* "renpy/display/render.pyx":1229
 * 
 *         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":1228
 *         rv = None
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 */
  }

  /* "renpy/display/render.pyx":1251
 *                     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, 1251, __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, 1251, __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, 1251, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1251, __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_15 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_13 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_14 = 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_13);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_11);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[5] = {&__pyx_t_13,&__pyx_t_15,&__pyx_t_14,&__pyx_t_12,&__pyx_t_11};
        for (i=0; i < 5; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 1251, __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_13,&__pyx_t_15,&__pyx_t_14,&__pyx_t_12,&__pyx_t_11};
      __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1251, __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_L30_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_10), 5) < 0) __PYX_ERR(0, 1251, __pyx_L1_error)
      __pyx_t_17 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L31_unpacking_done;
      __pyx_L30_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, 1251, __pyx_L1_error)
      __pyx_L31_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_13);
    __pyx_t_13 = 0;
    __Pyx_XDECREF_SET(__pyx_v_xo, __pyx_t_15);
    __pyx_t_15 = 0;
    __Pyx_XDECREF_SET(__pyx_v_yo, __pyx_t_14);
    __pyx_t_14 = 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":1253
 *         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, 1253, __pyx_L1_error)
    __pyx_t_18 = ((!__pyx_t_1) != 0);
    if (!__pyx_t_18) {
    } else {
      __pyx_t_2 = __pyx_t_18;
      goto __pyx_L33_bool_binop_done;
    }
    __pyx_t_18 = __Pyx_TypeCheck(__pyx_v_child, __pyx_ptype_5renpy_7display_6render_Render); 
    __pyx_t_1 = ((!(__pyx_t_18 != 0)) != 0);
    __pyx_t_2 = __pyx_t_1;
    __pyx_L33_bool_binop_done:;
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1254
 * 
 *             if not focus or not isinstance(child, Render):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             cx = x - xo
 */
      goto __pyx_L28_continue;

      /* "renpy/display/render.pyx":1253
 *         for child, xo, yo, focus, main in self.children:
 * 
 *             if not focus or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":1256
 *                 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, 1256, __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":1257
 * 
 *             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, 1257, __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":1259
 *             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, 1259, __pyx_L1_error)
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1260
 * 
 *             if self.forward:
 *                 cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *             cf = child.focus_at_point(cx, cy, screen)
 */
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->forward), __pyx_n_s_transform); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1260, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
          __pyx_t_6 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_cx, __pyx_v_cy};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1260, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) {
        PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_v_cx, __pyx_v_cy};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1260, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      {
        __pyx_t_14 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1260, __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_cx);
        __Pyx_GIVEREF(__pyx_v_cx);
        PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_6, __pyx_v_cx);
        __Pyx_INCREF(__pyx_v_cy);
        __Pyx_GIVEREF(__pyx_v_cy);
        PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_6, __pyx_v_cy);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1260, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1260, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_14);
        #else
        __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1260, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1260, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_14);
        #endif
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_12 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1260, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_17 = Py_TYPE(__pyx_t_12)->tp_iternext;
        index = 0; __pyx_t_11 = __pyx_t_17(__pyx_t_12); if (unlikely(!__pyx_t_11)) goto __pyx_L36_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 1; __pyx_t_14 = __pyx_t_17(__pyx_t_12); if (unlikely(!__pyx_t_14)) goto __pyx_L36_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_14);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_12), 2) < 0) __PYX_ERR(0, 1260, __pyx_L1_error)
        __pyx_t_17 = NULL;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L37_unpacking_done;
        __pyx_L36_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_17 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1260, __pyx_L1_error)
        __pyx_L37_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_cx, __pyx_t_11);
      __pyx_t_11 = 0;
      __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_14);
      __pyx_t_14 = 0;

      /* "renpy/display/render.pyx":1259
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    }

    /* "renpy/display/render.pyx":1262
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 *             cf = child.focus_at_point(cx, cy, screen)             # <<<<<<<<<<<<<<
 *             if cf is not None:
 *                 rv = cf
 */
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_focus_at_point); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1262, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __pyx_t_11 = NULL;
    __pyx_t_6 = 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_6 = 1;
      }
    }
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy, __pyx_v_screen};
      __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1262, __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_14)) {
      PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy, __pyx_v_screen};
      __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1262, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else
    #endif
    {
      __pyx_t_12 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      if (__pyx_t_11) {
        __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL;
      }
      __Pyx_INCREF(__pyx_v_cx);
      __Pyx_GIVEREF(__pyx_v_cx);
      PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_6, __pyx_v_cx);
      __Pyx_INCREF(__pyx_v_cy);
      __Pyx_GIVEREF(__pyx_v_cy);
      PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_6, __pyx_v_cy);
      __Pyx_INCREF(__pyx_v_screen);
      __Pyx_GIVEREF(__pyx_v_screen);
      PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_6, __pyx_v_screen);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1262, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    }
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1263
 * 
 *             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":1264
 *             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":1263
 * 
 *             cf = child.focus_at_point(cx, cy, screen)
 *             if cf is not None:             # <<<<<<<<<<<<<<
 *                 rv = cf
 * 
 */
    }

    /* "renpy/display/render.pyx":1251
 *                     rv = d, arg, screen
 * 
 *         for child, xo, yo, focus, main in self.children:             # <<<<<<<<<<<<<<
 * 
 *             if not focus or not isinstance(child, Render):
 */
    __pyx_L28_continue:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/display/render.pyx":1266
 *                 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":1267
 * 
 *         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, 1267, __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, 1267, __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, 1267, __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":1268
 *         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_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_focus_at_point); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1268, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_12 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_12);
          __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[4] = {__pyx_t_12, __pyx_v_x, __pyx_v_y, __pyx_v_screen};
        __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1268, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_4);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
        PyObject *__pyx_temp[4] = {__pyx_t_12, __pyx_v_x, __pyx_v_y, __pyx_v_screen};
        __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1268, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 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, 1268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_12) {
          __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = 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_14, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1268, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":1269
 *             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":1270
 *                 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":1269
 *             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":1267
 * 
 *         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":1266
 *                 rv = cf
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y, screen)
 */
  }

  /* "renpy/display/render.pyx":1272
 *                     rv = cf
 * 
 *         if (rv is None) and self.modal:             # <<<<<<<<<<<<<<
 *             if renpy.display.layout.check_modal(self.modal, None, x, y, self.width, self.height):
 *                 return Modal
 */
  __pyx_t_1 = (__pyx_v_rv == Py_None);
  __pyx_t_18 = (__pyx_t_1 != 0);
  if (__pyx_t_18) {
  } else {
    __pyx_t_2 = __pyx_t_18;
    goto __pyx_L44_bool_binop_done;
  }
  __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_self->modal); if (unlikely(__pyx_t_18 < 0)) __PYX_ERR(0, 1272, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_18;
  __pyx_L44_bool_binop_done:;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1273
 * 
 *         if (rv is None) and self.modal:
 *             if renpy.display.layout.check_modal(self.modal, None, x, y, self.width, self.height):             # <<<<<<<<<<<<<<
 *                 return Modal
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_display); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_layout); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_check_modal); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_12 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_14))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_12);
        __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[7] = {__pyx_t_12, __pyx_v_self->modal, Py_None, __pyx_v_x, __pyx_v_y, __pyx_t_4, __pyx_t_11};
      __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(__pyx_t_14)) {
      PyObject *__pyx_temp[7] = {__pyx_t_12, __pyx_v_self->modal, Py_None, __pyx_v_x, __pyx_v_y, __pyx_t_4, __pyx_t_11};
      __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_14, __pyx_temp+1-__pyx_t_6, 6+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else
    #endif
    {
      __pyx_t_15 = PyTuple_New(6+__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 1273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_15);
      if (__pyx_t_12) {
        __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_12); __pyx_t_12 = NULL;
      }
      __Pyx_INCREF(__pyx_v_self->modal);
      __Pyx_GIVEREF(__pyx_v_self->modal);
      PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_6, __pyx_v_self->modal);
      __Pyx_INCREF(Py_None);
      __Pyx_GIVEREF(Py_None);
      PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_6, Py_None);
      __Pyx_INCREF(__pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_15, 2+__pyx_t_6, __pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_15, 3+__pyx_t_6, __pyx_v_y);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_15, 4+__pyx_t_6, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_15, 5+__pyx_t_6, __pyx_t_11);
      __pyx_t_4 = 0;
      __pyx_t_11 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1273, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __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_5); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1273, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {

      /* "renpy/display/render.pyx":1274
 *         if (rv is None) and self.modal:
 *             if renpy.display.layout.check_modal(self.modal, None, x, y, self.width, self.height):
 *                 return Modal             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Modal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1274, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;

      /* "renpy/display/render.pyx":1273
 * 
 *         if (rv is None) and self.modal:
 *             if renpy.display.layout.check_modal(self.modal, None, x, y, self.width, self.height):             # <<<<<<<<<<<<<<
 *                 return Modal
 * 
 */
    }

    /* "renpy/display/render.pyx":1272
 *                     rv = cf
 * 
 *         if (rv is None) and self.modal:             # <<<<<<<<<<<<<<
 *             if renpy.display.layout.check_modal(self.modal, None, x, y, self.width, self.height):
 *                 return Modal
 */
  }

  /* "renpy/display/render.pyx":1276
 *                 return Modal
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1206
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, transform, 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":1279
 * 
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("main_displayables_at_point", 0, 3, 4, 1); __PYX_ERR(0, 1279, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_layers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("main_displayables_at_point", 0, 3, 4, 2); __PYX_ERR(0, 1279, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1279, __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, 1279, __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;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("main_displayables_at_point", 0);
  __Pyx_INCREF(__pyx_v_depth);

  /* "renpy/display/render.pyx":1285
 *         """
 * 
 *         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, 1285, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1287
 *         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, 1287, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1287, __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, 1287, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1287, __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, 1287, __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, 1287, __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, 1287, __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, 1287, __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, 1287, __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, 1287, __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":1288
 * 
 *         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":1287
 *         rv = [ ]
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
  }

  /* "renpy/display/render.pyx":1290
 *             return rv
 * 
 *         is_screen = False             # <<<<<<<<<<<<<<
 * 
 *         if depth is not None:
 */
  __pyx_v_is_screen = 0;

  /* "renpy/display/render.pyx":1292
 *         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":1293
 * 
 *         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, 1293, __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, 1293, __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, 1293, __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, 1293, __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, 1293, __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, 1293, __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, 1293, __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":1294
 *         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, 1294, __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, 1294, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1294, __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, 1294, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "renpy/display/render.pyx":1295
 *             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, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1295, __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":1297
 *                 depth += 1
 * 
 *                 if isinstance(d, renpy.display.screen.ScreenDisplayable):             # <<<<<<<<<<<<<<
 *                     is_screen = True
 * 
 */
      __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_renpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1297, __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, 1297, __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, 1297, __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, 1297, __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, 1297, __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":1298
 * 
 *                 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":1297
 *                 depth += 1
 * 
 *                 if isinstance(d, renpy.display.screen.ScreenDisplayable):             # <<<<<<<<<<<<<<
 *                     is_screen = True
 * 
 */
      }

      /* "renpy/display/render.pyx":1293
 * 
 *         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":1292
 *         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":1300
 *                     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, 1300, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1301
 * 
 *         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":1300
 *                     is_screen = True
 * 
 *         elif self.layer_name in layers:             # <<<<<<<<<<<<<<
 *             depth = 0
 * 
 */
  }
  __pyx_L8:;

  /* "renpy/display/render.pyx":1303
 *             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, 1303, __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, 1303, __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, 1303, __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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1303, __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, 1303, __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, 1303, __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, 1303, __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, 1303, __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":1304
 * 
 *         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, 1304, __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":1305
 *         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":1304
 * 
 *         for (child, xo, yo, focus, main) in self.children:
 *             if not main or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    }

    /* "renpy/display/render.pyx":1307
 *                 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, 1307, __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":1308
 * 
 *             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, 1308, __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":1310
 *             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, 1310, __pyx_L1_error)
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":1311
 * 
 *             if self.forward:
 *                 cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *             if is_screen:
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->forward), __pyx_n_s_transform); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1311, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = NULL;
      __pyx_t_16 = 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_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1311, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      #if CYTHON_FAST_PYCCALL
      if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
        PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1311, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_7);
      } else
      #endif
      {
        __pyx_t_10 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1311, __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_INCREF(__pyx_v_cx);
        __Pyx_GIVEREF(__pyx_v_cx);
        PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_16, __pyx_v_cx);
        __Pyx_INCREF(__pyx_v_cy);
        __Pyx_GIVEREF(__pyx_v_cy);
        PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_16, __pyx_v_cy);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1311, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1311, __pyx_L1_error)
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        if (likely(PyTuple_CheckExact(sequence))) {
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_10);
        #else
        __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1311, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1311, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        #endif
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1311, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_14 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_12 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_12)) goto __pyx_L20_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 1; __pyx_t_10 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L20_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_11), 2) < 0) __PYX_ERR(0, 1311, __pyx_L1_error)
        __pyx_t_14 = NULL;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L21_unpacking_done;
        __pyx_L20_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_14 = NULL;
        if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
        __PYX_ERR(0, 1311, __pyx_L1_error)
        __pyx_L21_unpacking_done:;
      }
      __Pyx_DECREF_SET(__pyx_v_cx, __pyx_t_12);
      __pyx_t_12 = 0;
      __Pyx_DECREF_SET(__pyx_v_cy, __pyx_t_10);
      __pyx_t_10 = 0;

      /* "renpy/display/render.pyx":1310
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    }

    /* "renpy/display/render.pyx":1313
 *                 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":1315
 *             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_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_main_displayables_at_point); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = __Pyx_PyInt_SubtractObjC(__pyx_v_depth, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1315, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = NULL;
      __pyx_t_16 = 0;
      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);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy, __pyx_v_layers, __pyx_t_12};
        __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 4+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1315, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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_10)) {
        PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_v_cx, __pyx_v_cy, __pyx_v_layers, __pyx_t_12};
        __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_16, 4+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1315, __pyx_L1_error)
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 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_16); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1315, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (__pyx_t_11) {
          __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_11); __pyx_t_11 = NULL;
        }
        __Pyx_INCREF(__pyx_v_cx);
        __Pyx_GIVEREF(__pyx_v_cx);
        PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_16, __pyx_v_cx);
        __Pyx_INCREF(__pyx_v_cy);
        __Pyx_GIVEREF(__pyx_v_cy);
        PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_16, __pyx_v_cy);
        __Pyx_INCREF(__pyx_v_layers);
        __Pyx_GIVEREF(__pyx_v_layers);
        PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_16, __pyx_v_layers);
        __Pyx_GIVEREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_16, __pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1315, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/display/render.pyx":1316
 *                 # 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__10, 1, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1316, __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, 1316, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "renpy/display/render.pyx":1313
 *                 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_L22;
    }

    /* "renpy/display/render.pyx":1318
 *                 rv.extend(cf[1:])
 *             else:
 *                 cf = child.main_displayables_at_point(cx, cy, layers, depth)             # <<<<<<<<<<<<<<
 *                 rv.extend(cf)
 * 
 */
    /*else*/ {
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s_main_displayables_at_point); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1318, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_4 = NULL;
      __pyx_t_16 = 0;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_10, function);
          __pyx_t_16 = 1;
        }
      }
      #if CYTHON_FAST_PYCALL
      if (PyFunction_Check(__pyx_t_10)) {
        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_10, __pyx_temp+1-__pyx_t_16, 4+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1318, __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_10)) {
        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_10, __pyx_temp+1-__pyx_t_16, 4+__pyx_t_16); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1318, __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_16); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1318, __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_16, __pyx_v_cx);
        __Pyx_INCREF(__pyx_v_cy);
        __Pyx_GIVEREF(__pyx_v_cy);
        PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_16, __pyx_v_cy);
        __Pyx_INCREF(__pyx_v_layers);
        __Pyx_GIVEREF(__pyx_v_layers);
        PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_16, __pyx_v_layers);
        __Pyx_INCREF(__pyx_v_depth);
        __Pyx_GIVEREF(__pyx_v_depth);
        PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_16, __pyx_v_depth);
        __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_12, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1318, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF_SET(__pyx_v_cf, __pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/display/render.pyx":1319
 *             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, 1319, __pyx_L1_error)
    }
    __pyx_L22:;

    /* "renpy/display/render.pyx":1303
 *             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":1321
 *                 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":1279
 * 
 * 
 *     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":1324
 * 
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_opaque", 0);

  /* "renpy/display/render.pyx":1330
 *         """
 * 
 *         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, 1330, __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":1331
 * 
 *         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, 1331, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1330
 *         """
 * 
 *         if self.opaque is not None:             # <<<<<<<<<<<<<<
 *             return self.opaque
 * 
 */
  }

  /* "renpy/display/render.pyx":1335
 *         # 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, 1335, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1336
 *         # 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":1337
 *         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":1335
 *         # 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":1339
 *             return False
 * 
 *         rv = False             # <<<<<<<<<<<<<<
 *         vc = [ ]
 * 
 */
  __pyx_v_rv = 0;

  /* "renpy/display/render.pyx":1340
 * 
 *         rv = False
 *         vc = [ ]             # <<<<<<<<<<<<<<
 * 
 *         for i in self.children:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1340, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_vc = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1342
 *         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, 1342, __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, 1342, __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, 1342, __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":1343
 * 
 *         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;
      Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        __PYX_ERR(0, 1343, __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, 1343, __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, 1343, __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, 1343, __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, 1343, __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":1345
 *             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, 1345, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1345, __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, 1345, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1345, __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":1346
 * 
 *             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, 1346, __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);
        }
      }
      __pyx_t_9 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_8);
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1346, __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;
        Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
        if (unlikely(size != 2)) {
          if (size > 2) __Pyx_RaiseTooManyValuesError(2);
          else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
          __PYX_ERR(0, 1346, __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, 1346, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1346, __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, 1346, __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, 1346, __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, 1346, __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":1347
 *             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, 1347, __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, 1347, __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, 1347, __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, 1347, __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, 1347, __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, 1347, __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, 1347, __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, 1347, __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":1348
 *                 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, 1348, __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);
          }
        }
        __pyx_t_9 = (__pyx_t_8) ? __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8) : __Pyx_PyObject_CallNoArg(__pyx_t_7);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1348, __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, 1348, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (__pyx_t_3) {

          /* "renpy/display/render.pyx":1349
 *                 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, 1349, __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":1350
 *                     if child.is_opaque():
 *                         vc = [ ]
 *                         rv = True             # <<<<<<<<<<<<<<
 * 
 *             vc.append(i)
 */
          __pyx_v_rv = 1;

          /* "renpy/display/render.pyx":1348
 *                 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":1347
 *             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":1345
 *             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":1352
 *                         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, 1352, __pyx_L1_error)

    /* "renpy/display/render.pyx":1342
 *         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":1354
 *             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":1355
 * 
 *         self.visible_children = vc
 *         self.opaque = rv             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  __pyx_v_self->opaque = __pyx_v_rv;

  /* "renpy/display/render.pyx":1356
 *         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, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1324
 * 
 * 
 *     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":1359
 * 
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 2, 2, 1); __PYX_ERR(0, 1359, __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, 1359, __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, 1359, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_pixel_opaque", 0);

  /* "renpy/display/render.pyx":1364
 *         """
 * 
 *         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, 1364, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1364, __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, 1364, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1364, __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, 1364, __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, 1364, __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, 1364, __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, 1364, __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, 1364, __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, 1364, __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":1365
 * 
 *         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":1364
 *         """
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  }

  /* "renpy/display/render.pyx":1367
 *             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, 1367, __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);
    }
  }
  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1367, __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, 1367, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1368
 * 
 *         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":1367
 *             return False
 * 
 *         if self.is_opaque():             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  }

  /* "renpy/display/render.pyx":1370
 *             return True
 * 
 *         return renpy.display.draw.is_pixel_opaque(self, x, y)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1370, __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, 1370, __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, 1370, __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, 1370, __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, 1370, __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, 1370, __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, 1370, __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, 1370, __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":1359
 * 
 * 
 *     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":1373
 * 
 * 
 *     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;
  struct __pyx_opt_args_5renpy_7display_6render_6Render_blit __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fill", 0);
  __Pyx_INCREF(__pyx_v_color);

  /* "renpy/display/render.pyx":1378
 *         """
 * 
 *         color = renpy.easy.color(color)             # <<<<<<<<<<<<<<
 *         solid = renpy.display.imagelike.Solid(color)
 *         surf = render(solid, self.width, self.height, 0, 0)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1378, __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, 1378, __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, 1378, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_color);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1378, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __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":1379
 * 
 *         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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __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, 1379, __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_imagelike); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1379, __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_Solid); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1379, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_color);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1379, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_solid = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1380
 *         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, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __pyx_f_5renpy_7display_6render_render(__pyx_v_solid, __pyx_t_1, __pyx_t_3, 0.0, 0.0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1380, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_surf = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1381
 *         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_4.__pyx_n = 2;
  __pyx_t_4.focus = Py_False;
  __pyx_t_4.main = Py_False;
  ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)__pyx_v_self->__pyx_vtab)->blit(__pyx_v_self, __pyx_v_surf, __pyx_tuple__9, 0, &__pyx_t_4); 

  /* "renpy/display/render.pyx":1373
 * 
 * 
 *     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_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":1384
 * 
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("canvas", 0);

  /* "renpy/display/render.pyx":1389
 *         """
 * 
 *         surf = renpy.display.pgrender.surface((self.width, self.height), True)             # <<<<<<<<<<<<<<
 * 
 *         mutated_surface(surf)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1389, __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, 1389, __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, 1389, __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, 1389, __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, 1389, __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, 1389, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1389, __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, 1389, __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, 1389, __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, 1389, __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, 1389, __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":1391
 *         surf = renpy.display.pgrender.surface((self.width, self.height), True)
 * 
 *         mutated_surface(surf)             # <<<<<<<<<<<<<<
 * 
 *         self.blit(surf, (0, 0))
 */
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_mutated_surface); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1391, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surf) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surf);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1391, __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":1393
 *         mutated_surface(surf)
 * 
 *         self.blit(surf, (0, 0))             # <<<<<<<<<<<<<<
 * 
 *         return Canvas(surf)
 */
  (void)(((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)__pyx_v_self->__pyx_vtab)->blit(__pyx_v_self, __pyx_v_surf, __pyx_tuple__9, 0, NULL));

  /* "renpy/display/render.pyx":1395
 *         self.blit(surf, (0, 0))
 * 
 *         return Canvas(surf)             # <<<<<<<<<<<<<<
 * 
 *     def screen_rect(self, double sx, double sy, Matrix transform):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Canvas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1395, __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);
    }
  }
  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_v_surf) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_surf);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1395, __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":1384
 * 
 * 
 *     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":1397
 *         return Canvas(surf)
 * 
 *     def screen_rect(self, double sx, double sy, Matrix 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_6matrix_Matrix *__pyx_v_transform = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sx)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sy)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("screen_rect", 1, 3, 3, 1); __PYX_ERR(0, 1397, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_transform)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("screen_rect", 1, 3, 3, 2); __PYX_ERR(0, 1397, __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, 1397, __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, 1397, __pyx_L3_error)
    __pyx_v_sy = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_sy == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1397, __pyx_L3_error)
    __pyx_v_transform = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)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, 1397, __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_6matrix_Matrix, 1, "transform", 0))) __PYX_ERR(0, 1397, __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_6matrix_Matrix *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("screen_rect", 0);
  __Pyx_INCREF((PyObject *)__pyx_v_transform);

  /* "renpy/display/render.pyx":1404
 *         """
 * 
 *         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":1405
 * 
 *         if transform is None:
 *             transform = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         cdef double w = self.width
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1405, __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_6matrix_Matrix))))) __PYX_ERR(0, 1405, __pyx_L1_error)
    __Pyx_DECREF_SET(__pyx_v_transform, ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)__pyx_t_3));
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1404
 *         """
 * 
 *         if transform is None:             # <<<<<<<<<<<<<<
 *             transform = IDENTITY
 * 
 */
  }

  /* "renpy/display/render.pyx":1407
 *             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":1408
 * 
 *         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":1410
 *         cdef double h = self.height
 * 
 *         cdef double xdx = transform.xdx             # <<<<<<<<<<<<<<
 *         cdef double xdy = transform.xdy
 *         cdef double ydx = transform.ydx
 */
  __pyx_t_4 = __pyx_v_transform->xdx;
  __pyx_v_xdx = __pyx_t_4;

  /* "renpy/display/render.pyx":1411
 * 
 *         cdef double xdx = transform.xdx
 *         cdef double xdy = transform.xdy             # <<<<<<<<<<<<<<
 *         cdef double ydx = transform.ydx
 *         cdef double ydy = transform.ydy
 */
  __pyx_t_4 = __pyx_v_transform->xdy;
  __pyx_v_xdy = __pyx_t_4;

  /* "renpy/display/render.pyx":1412
 *         cdef double xdx = transform.xdx
 *         cdef double xdy = transform.xdy
 *         cdef double ydx = transform.ydx             # <<<<<<<<<<<<<<
 *         cdef double ydy = transform.ydy
 * 
 */
  __pyx_t_4 = __pyx_v_transform->ydx;
  __pyx_v_ydx = __pyx_t_4;

  /* "renpy/display/render.pyx":1413
 *         cdef double xdy = transform.xdy
 *         cdef double ydx = transform.ydx
 *         cdef double ydy = transform.ydy             # <<<<<<<<<<<<<<
 * 
 *         # Transform the vertex coordinates to screen-space.
 */
  __pyx_t_4 = __pyx_v_transform->ydy;
  __pyx_v_ydy = __pyx_t_4;

  /* "renpy/display/render.pyx":1416
 * 
 *         # 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":1417
 *         # 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":1419
 *         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":1420
 * 
 *         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":1422
 *         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":1423
 * 
 *         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":1425
 *         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":1426
 * 
 *         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":1428
 *         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":1429
 * 
 *         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":1430
 *         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":1431
 *         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":1433
 *         cdef double maxy = max(y0, y1, y2, y3)
 * 
 *         return (             # <<<<<<<<<<<<<<
 *             int(minx),
 *             int(miny),
 */
  __Pyx_XDECREF(__pyx_r);

  /* "renpy/display/render.pyx":1434
 * 
 *         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, 1434, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "renpy/display/render.pyx":1435
 *         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, 1435, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);

  /* "renpy/display/render.pyx":1436
 *             int(minx),
 *             int(miny),
 *             int(math.ceil(maxx - minx)),             # <<<<<<<<<<<<<<
 *             int(math.ceil(maxy - miny)),
 *             )
 */
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_math); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1436, __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, 1436, __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, 1436, __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);
    }
  }
  __pyx_t_11 = (__pyx_t_14) ? __Pyx_PyObject_Call2Args(__pyx_t_13, __pyx_t_14, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12);
  __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __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, 1436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1437
 *             int(miny),
 *             int(math.ceil(maxx - minx)),
 *             int(math.ceil(maxy - miny)),             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_12, __pyx_n_s_math); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_ceil); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = PyFloat_FromDouble((__pyx_v_maxy - __pyx_v_miny)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __pyx_t_15 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(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_11 = (__pyx_t_15) ? __Pyx_PyObject_Call2Args(__pyx_t_14, __pyx_t_15, __pyx_t_12) : __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_12);
  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __pyx_t_14 = __Pyx_PyNumber_Int(__pyx_t_11); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 1437, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "renpy/display/render.pyx":1434
 * 
 *         return (
 *             int(minx),             # <<<<<<<<<<<<<<
 *             int(miny),
 *             int(math.ceil(maxx - minx)),
 */
  __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1434, __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_14);
  PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_14);
  __pyx_t_3 = 0;
  __pyx_t_10 = 0;
  __pyx_t_13 = 0;
  __pyx_t_14 = 0;
  __pyx_r = __pyx_t_11;
  __pyx_t_11 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1397
 *         return Canvas(surf)
 * 
 *     def screen_rect(self, double sx, double sy, Matrix 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_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":1440
 *             )
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__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 = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x);
          if (value) { values[1] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y);
          if (value) { values[2] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width);
          if (value) { values[3] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height);
          if (value) { values[4] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_st);
          if (value) { values[5] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  6:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_at);
          if (value) { values[6] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  7:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_render);
          if (value) { values[7] = value; kw_args--; }
        }
        CYTHON_FALLTHROUGH;
        case  8:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1440, __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, 1440, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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":1445
 *         """
 * 
 *         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":1446
 * 
 *         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, 1446, __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":1445
 *         """
 * 
 *         if width is None:             # <<<<<<<<<<<<<<
 *             width = self.width
 *         if height is None:
 */
  }

  /* "renpy/display/render.pyx":1447
 *         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":1448
 *             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, 1448, __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":1447
 *         if width is None:
 *             width = self.width
 *         if height is None:             # <<<<<<<<<<<<<<
 *             height = self.height
 * 
 */
  }

  /* "renpy/display/render.pyx":1450
 *             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":1451
 * 
 *         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":1452
 *         if render is None:
 *             if st is None:
 *                 st = render_st             # <<<<<<<<<<<<<<
 *             if at is None:
 *                 at = render_at
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_render_st); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1452, __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":1451
 * 
 *         if render is None:
 *             if st is None:             # <<<<<<<<<<<<<<
 *                 st = render_st
 *             if at is None:
 */
    }

    /* "renpy/display/render.pyx":1453
 *             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":1454
 *                 st = render_st
 *             if at is None:
 *                 at = render_at             # <<<<<<<<<<<<<<
 * 
 *             render = renpy.display.render.render(d, width, height, st, at)
 */
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_render_at); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1454, __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":1453
 *             if st is None:
 *                 st = render_st
 *             if at is None:             # <<<<<<<<<<<<<<
 *                 at = render_at
 * 
 */
    }

    /* "renpy/display/render.pyx":1456
 *                 at = render_at
 * 
 *             render = renpy.display.render.render(d, width, height, st, at)             # <<<<<<<<<<<<<<
 * 
 *         d.place(self, x, y, width, height, render, main=main)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_renpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1456, __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, 1456, __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, 1456, __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, 1456, __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, 1456, __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, 1456, __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, 1456, __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, 1456, __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":1450
 *             height = self.height
 * 
 *         if render is None:             # <<<<<<<<<<<<<<
 *             if st is None:
 *                 st = render_st
 */
  }

  /* "renpy/display/render.pyx":1458
 *             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, 1458, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1458, __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, 1458, __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, 1458, __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, 1458, __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":1440
 *             )
 * 
 *     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":1460
 *         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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_xzoom)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_yzoom)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("zoom", 1, 2, 2, 1); __PYX_ERR(0, 1460, __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, 1460, __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, 1460, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("zoom", 0);

  /* "renpy/display/render.pyx":1464
 *         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":1465
 *         """
 *         if self.reverse is None:
 *             self.reverse = IDENTITY             # <<<<<<<<<<<<<<
 *             self.forward = IDENTITY
 * 
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __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_6matrix_Matrix))))) __PYX_ERR(0, 1465, __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_6matrix_Matrix *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1466
 *         if self.reverse is None:
 *             self.reverse = IDENTITY
 *             self.forward = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         self.reverse *= Matrix2D(xzoom, 0, 0, yzoom)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_IDENTITY); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1466, __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_6matrix_Matrix))))) __PYX_ERR(0, 1466, __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_6matrix_Matrix *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1464
 *         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":1468
 *             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, 1468, __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_6matrix_Matrix2D), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1468, __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, 1468, __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_6matrix_Matrix))))) __PYX_ERR(0, 1468, __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_6matrix_Matrix *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1470
 *         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, 1470, __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, 1470, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1471
 * 
 *         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, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyFloat_DivideCObj(__pyx_float_1_0, __pyx_v_yzoom, 1.0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1471, __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_6matrix_Matrix2D), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1471, __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, 1471, __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_6matrix_Matrix))))) __PYX_ERR(0, 1471, __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_6matrix_Matrix *)__pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1470
 *         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":1473
 *             self.forward *= Matrix2D(1.0 / xzoom, 0, 0, 1.0 / yzoom)
 *         else:
 *             self.forward *= Matrix2D(0, 0, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def add_shader(self, shader):
 */
  /*else*/ {
    __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix2D), __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1473, __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, 1473, __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_6matrix_Matrix))))) __PYX_ERR(0, 1473, __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_6matrix_Matrix *)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L4:;

  /* "renpy/display/render.pyx":1460
 *         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.pyx":1475
 *             self.forward *= Matrix2D(0, 0, 0, 0)
 * 
 *     def add_shader(self, shader):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a shader to the list of shaders that will be used to render
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_49add_shader(PyObject *__pyx_v_self, PyObject *__pyx_v_shader); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_48add_shader[] = "\n        Adds a shader to the list of shaders that will be used to render\n        this Render and its children.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_49add_shader(PyObject *__pyx_v_self, PyObject *__pyx_v_shader) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_shader (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_48add_shader(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), ((PyObject *)__pyx_v_shader));

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_48add_shader(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_shader) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_shader", 0);

  /* "renpy/display/render.pyx":1481
 *         """
 * 
 *         if self.shaders is None:             # <<<<<<<<<<<<<<
 *             self.shaders = (shader,)
 *             return
 */
  __pyx_t_1 = (__pyx_v_self->shaders == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1482
 * 
 *         if self.shaders is None:
 *             self.shaders = (shader,)             # <<<<<<<<<<<<<<
 *             return
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1482, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_shader);
    __Pyx_GIVEREF(__pyx_v_shader);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_shader);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->shaders);
    __Pyx_DECREF(__pyx_v_self->shaders);
    __pyx_v_self->shaders = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1483
 *         if self.shaders is None:
 *             self.shaders = (shader,)
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if shader in self.shaders:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1481
 *         """
 * 
 *         if self.shaders is None:             # <<<<<<<<<<<<<<
 *             self.shaders = (shader,)
 *             return
 */
  }

  /* "renpy/display/render.pyx":1485
 *             return
 * 
 *         if shader in self.shaders:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_shader, __pyx_v_self->shaders, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1485, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "renpy/display/render.pyx":1486
 * 
 *         if shader in self.shaders:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         self.shaders = self.shaders + (shader,)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "renpy/display/render.pyx":1485
 *             return
 * 
 *         if shader in self.shaders:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  }

  /* "renpy/display/render.pyx":1488
 *             return
 * 
 *         self.shaders = self.shaders + (shader,)             # <<<<<<<<<<<<<<
 * 
 *     def add_uniform(self, name, value):
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_shader);
  __Pyx_GIVEREF(__pyx_v_shader);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_shader);
  __pyx_t_4 = PyNumber_Add(__pyx_v_self->shaders, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_GOTREF(__pyx_v_self->shaders);
  __Pyx_DECREF(__pyx_v_self->shaders);
  __pyx_v_self->shaders = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":1475
 *             self.forward *= Matrix2D(0, 0, 0, 0)
 * 
 *     def add_shader(self, shader):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a shader to the list of shaders that will be used to render
 */

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

/* "renpy/display/render.pyx":1490
 *         self.shaders = self.shaders + (shader,)
 * 
 *     def add_uniform(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a uniform with the given name and value that will be passed
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_51add_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_50add_uniform[] = "\n        Adds a uniform with the given name and value that will be passed\n        to the shaders that render this Render and its children.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_51add_uniform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_uniform (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_value,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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_uniform", 1, 2, 2, 1); __PYX_ERR(0, 1490, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_uniform") < 0)) __PYX_ERR(0, 1490, __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_name = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_uniform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1490, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.add_uniform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_50add_uniform(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_name, __pyx_v_value);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_50add_uniform(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_uniform", 0);

  /* "renpy/display/render.pyx":1496
 *         """
 * 
 *         if self.uniforms is None:             # <<<<<<<<<<<<<<
 *             self.uniforms = { name : value }
 *         else:
 */
  __pyx_t_1 = (__pyx_v_self->uniforms == ((PyObject*)Py_None));
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1497
 * 
 *         if self.uniforms is None:
 *             self.uniforms = { name : value }             # <<<<<<<<<<<<<<
 *         else:
 *             self.uniforms[name] = value
 */
    __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1497, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (PyDict_SetItem(__pyx_t_3, __pyx_v_name, __pyx_v_value) < 0) __PYX_ERR(0, 1497, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF(__pyx_v_self->uniforms);
    __Pyx_DECREF(__pyx_v_self->uniforms);
    __pyx_v_self->uniforms = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":1496
 *         """
 * 
 *         if self.uniforms is None:             # <<<<<<<<<<<<<<
 *             self.uniforms = { name : value }
 *         else:
 */
    goto __pyx_L3;
  }

  /* "renpy/display/render.pyx":1499
 *             self.uniforms = { name : value }
 *         else:
 *             self.uniforms[name] = value             # <<<<<<<<<<<<<<
 * 
 *     def add_property(self, name, value):
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->uniforms == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1499, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_self->uniforms, __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 1499, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":1490
 *         self.shaders = self.shaders + (shader,)
 * 
 *     def add_uniform(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a uniform with the given name and value that will be passed
 */

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

/* "renpy/display/render.pyx":1501
 *             self.uniforms[name] = value
 * 
 *     def add_property(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a render property with name and value.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_53add_property(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_52add_property[] = "\n        Adds a render property with name and value.\n        ";
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_53add_property(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_value = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_property (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_value,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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("add_property", 1, 2, 2, 1); __PYX_ERR(0, 1501, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_property") < 0)) __PYX_ERR(0, 1501, __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_name = values[0];
    __pyx_v_value = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_property", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1501, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.add_property", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_52add_property(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_name, __pyx_v_value);

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_52add_property(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("add_property", 0);
  __Pyx_INCREF(__pyx_v_name);

  /* "renpy/display/render.pyx":1506
 *         """
 * 
 *         if name[:3] == "gl_":             # <<<<<<<<<<<<<<
 *             name = name[3:]
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_name, 0, 3, NULL, NULL, &__pyx_slice__12, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_gl, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1506, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1507
 * 
 *         if name[:3] == "gl_":
 *             name = name[3:]             # <<<<<<<<<<<<<<
 * 
 *         if self.properties is None:
 */
    __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_name, 3, 0, NULL, NULL, &__pyx_slice__13, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1507, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":1506
 *         """
 * 
 *         if name[:3] == "gl_":             # <<<<<<<<<<<<<<
 *             name = name[3:]
 * 
 */
  }

  /* "renpy/display/render.pyx":1509
 *             name = name[3:]
 * 
 *         if self.properties is None:             # <<<<<<<<<<<<<<
 *             self.properties = { name : value }
 *         else:
 */
  __pyx_t_2 = (__pyx_v_self->properties == ((PyObject*)Py_None));
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1510
 * 
 *         if self.properties is None:
 *             self.properties = { name : value }             # <<<<<<<<<<<<<<
 *         else:
 *             self.properties[name] = value
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_t_1, __pyx_v_name, __pyx_v_value) < 0) __PYX_ERR(0, 1510, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(__pyx_v_self->properties);
    __Pyx_DECREF(__pyx_v_self->properties);
    __pyx_v_self->properties = ((PyObject*)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":1509
 *             name = name[3:]
 * 
 *         if self.properties is None:             # <<<<<<<<<<<<<<
 *             self.properties = { name : value }
 *         else:
 */
    goto __pyx_L4;
  }

  /* "renpy/display/render.pyx":1512
 *             self.properties = { name : value }
 *         else:
 *             self.properties[name] = value             # <<<<<<<<<<<<<<
 * 
 * class Canvas(object):
 */
  /*else*/ {
    if (unlikely(__pyx_v_self->properties == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1512, __pyx_L1_error)
    }
    if (unlikely(PyDict_SetItem(__pyx_v_self->properties, __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 1512, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "renpy/display/render.pyx":1501
 *             self.uniforms[name] = value
 * 
 *     def add_property(self, name, value):             # <<<<<<<<<<<<<<
 *         """
 *         Adds a render property with name and value.
 */

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

/* "renpy/display/render.pxd":27
 * 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 27, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 27, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 27, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 27, __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":29
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 29, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 29, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 29, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 29, __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":30
 * 
 *     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":32
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 32, __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":33
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 33, __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":34
 *     cdef public list children
 *     cdef public set parents
 *     cdef public list depends_on_list             # <<<<<<<<<<<<<<
 * 
 *     # gl, sw: The drawing operation and its parameters.
 */

/* 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 34, __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":37
 * 
 *     # gl, sw: The drawing operation and its parameters.
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 37, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 37, __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":38
 *     # gl, sw: The drawing operation and its parameters.
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 38, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 38, __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":39
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 39, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 39, __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":40
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha
 *     cdef public object operation_parameter             # <<<<<<<<<<<<<<
 * 
 *     # The transform toward texture space
 */

/* 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":43
 * 
 *     # The transform toward texture space
 *     cdef public Matrix forward             # <<<<<<<<<<<<<<
 * 
 *     # The transform toward screen space.
 */

/* 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(1, 43, __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_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.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_6matrix_Matrix *)Py_None);

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

/* "renpy/display/render.pxd":46
 * 
 *     # The transform toward screen space.
 *     cdef public Matrix reverse             # <<<<<<<<<<<<<<
 * 
 *     # Alpha multiplication - this is multipled with r, g, b, and a, to reduce
 */

/* 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(1, 46, __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_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.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_6matrix_Matrix *)Py_None);

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

/* "renpy/display/render.pxd":50
 *     # Alpha multiplication - this is multipled with r, g, b, and a, to reduce
 *     # the alpha of this Render and its children.
 *     cdef public double alpha             # <<<<<<<<<<<<<<
 * 
 *     # Over multiplication - this is multiplied with a. This is really (1-additive),
 */

/* 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 50, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 50, __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":54
 *     # Over multiplication - this is multiplied with a. This is really (1-additive),
 *     # such that if this is 0.0, additive blending occurs.
 *     cdef public double over             # <<<<<<<<<<<<<<
 * 
 *     # True if child textures should be rendered in nearest-neighbor mode.
 */

/* 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 54, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 54, __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":57
 * 
 *     # True if child textures should be rendered in nearest-neighbor mode.
 *     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":59
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 59, __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":60
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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->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":61
 *     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":63
 *     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":64
 * 
 *     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":66
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 66, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 66, __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":67
 * 
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 67, __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":69
 *     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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 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.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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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->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":70
 * 
 *     cdef public bint xclipping
 *     cdef public bint yclipping             # <<<<<<<<<<<<<<
 * 
 *     # gl, sw: Caching of render-to-texture.
 */

/* 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 70, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 70, __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":73
 * 
 *     # gl, sw: Caching of render-to-texture.
 *     cdef public object surface, alpha_surface, half_cache             # <<<<<<<<<<<<<<
 * 
 *     cdef public object 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":75
 *     cdef public object surface, alpha_surface, half_cache
 * 
 *     cdef public object 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
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->modal);
  __pyx_r = __pyx_v_self->modal;
  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_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
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->modal);
  __Pyx_DECREF(__pyx_v_self->modal);
  __pyx_v_self->modal = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_5modal_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_5modal_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_5modal_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_5modal_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->modal);
  __Pyx_DECREF(__pyx_v_self->modal);
  __pyx_v_self->modal = Py_None;

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

/* "renpy/display/render.pxd":77
 *     cdef public object modal
 * 
 *     cdef public bint text_input             # <<<<<<<<<<<<<<
 * 
 *     # gl2 ######################################################################
 */

/* 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 77, __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 77, __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;
}

/* "renpy/display/render.pxd":84
 *     # and used to form a model. If this is True, the Mesh is taken from the first
 *     # child's Texture, otherwise this must be a Mesh.
 *     cdef public object mesh             # <<<<<<<<<<<<<<
 * 
 *     # A tuple of shaders that will be used when rendering, or None.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_4mesh_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_4mesh_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_4mesh___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_4mesh___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->mesh);
  __pyx_r = __pyx_v_self->mesh;
  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_4mesh_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_4mesh_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_4mesh_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_4mesh_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->mesh);
  __Pyx_DECREF(__pyx_v_self->mesh);
  __pyx_v_self->mesh = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_4mesh_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_4mesh_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_4mesh_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_4mesh_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->mesh);
  __Pyx_DECREF(__pyx_v_self->mesh);
  __pyx_v_self->mesh = Py_None;

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

/* "renpy/display/render.pxd":87
 * 
 *     # A tuple of shaders that will be used when rendering, or None.
 *     cdef public tuple shaders             # <<<<<<<<<<<<<<
 * 
 *     # A dictionary containing uniforms that will be used when rendering, or
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7shaders_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_7shaders_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_7shaders___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_7shaders___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->shaders);
  __pyx_r = __pyx_v_self->shaders;
  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_7shaders_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7shaders_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_7shaders_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_7shaders_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 87, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->shaders);
  __Pyx_DECREF(__pyx_v_self->shaders);
  __pyx_v_self->shaders = ((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.shaders.__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_7shaders_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_7shaders_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_7shaders_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_7shaders_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->shaders);
  __Pyx_DECREF(__pyx_v_self->shaders);
  __pyx_v_self->shaders = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":91
 *     # A dictionary containing uniforms that will be used when rendering, or
 *     # None.
 *     cdef public dict uniforms             # <<<<<<<<<<<<<<
 * 
 *     # Properties that control rendering.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_8uniforms_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_8uniforms_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_8uniforms___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_8uniforms___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->uniforms);
  __pyx_r = __pyx_v_self->uniforms;
  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_8uniforms_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_8uniforms_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_8uniforms_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_8uniforms_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 91, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->uniforms);
  __Pyx_DECREF(__pyx_v_self->uniforms);
  __pyx_v_self->uniforms = ((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.uniforms.__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_8uniforms_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_8uniforms_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_8uniforms_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_8uniforms_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->uniforms);
  __Pyx_DECREF(__pyx_v_self->uniforms);
  __pyx_v_self->uniforms = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":94
 * 
 *     # Properties that control rendering.
 *     cdef public dict properties             # <<<<<<<<<<<<<<
 * 
 *     # Used to cache the result of rendering this Render to a texture.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10properties_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_10properties_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_10properties___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_10properties___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->properties);
  __pyx_r = __pyx_v_self->properties;
  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_10properties_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_10properties_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_10properties_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_10properties_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(1, 94, __pyx_L1_error)
  __pyx_t_1 = __pyx_v_value;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->properties);
  __Pyx_DECREF(__pyx_v_self->properties);
  __pyx_v_self->properties = ((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.properties.__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_10properties_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_10properties_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_10properties_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_10properties_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->properties);
  __Pyx_DECREF(__pyx_v_self->properties);
  __pyx_v_self->properties = ((PyObject*)Py_None);

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

/* "renpy/display/render.pxd":97
 * 
 *     # Used to cache the result of rendering this Render to a texture.
 *     cdef public object cached_texture             # <<<<<<<<<<<<<<
 * 
 *     # Used to cache the model.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_14cached_texture_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_14cached_texture_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_14cached_texture___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_14cached_texture___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->cached_texture);
  __pyx_r = __pyx_v_self->cached_texture;
  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_14cached_texture_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_14cached_texture_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_14cached_texture_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_14cached_texture_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->cached_texture);
  __Pyx_DECREF(__pyx_v_self->cached_texture);
  __pyx_v_self->cached_texture = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_14cached_texture_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_14cached_texture_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_14cached_texture_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_14cached_texture_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->cached_texture);
  __Pyx_DECREF(__pyx_v_self->cached_texture);
  __pyx_v_self->cached_texture = Py_None;

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

/* "renpy/display/render.pxd":100
 * 
 *     # Used to cache the model.
 *     cdef public object cached_model             # <<<<<<<<<<<<<<
 * 
 *     # True if the texture has been loaded.
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12cached_model_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_12cached_model_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_12cached_model___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_12cached_model___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->cached_model);
  __pyx_r = __pyx_v_self->cached_model;
  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_12cached_model_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_12cached_model_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_12cached_model_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_12cached_model_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->cached_model);
  __Pyx_DECREF(__pyx_v_self->cached_model);
  __pyx_v_self->cached_model = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_7display_6render_6Render_12cached_model_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_12cached_model_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_7display_6render_6Render_12cached_model_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_12cached_model_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->cached_model);
  __Pyx_DECREF(__pyx_v_self->cached_model);
  __pyx_v_self->cached_model = Py_None;

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

/* "renpy/display/render.pxd":103
 * 
 *     # True if the texture has been loaded.
 *     cdef public bint loaded             # <<<<<<<<<<<<<<
 * 
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_6loaded_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_6loaded_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_6loaded___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_6loaded___get__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->loaded); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 103, __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.loaded.__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_6loaded_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_7display_6render_6Render_6loaded_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_6loaded_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_6loaded_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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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, 103, __pyx_L1_error)
  __pyx_v_self->loaded = __pyx_t_1;

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.loaded.__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 tuple state
 *     cdef object _dict
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_55__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_55__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_54__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_54__reduce_cython__(struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.cached_model, self.cached_texture, 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.loaded, self.mark, self.mesh, 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.properties, self.render_of, self.reverse, self.shaders, self.surface, self.text_input, self.uniforms, 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, 5, __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, 5, __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, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_self->loaded); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_v_self->mark); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 5, __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, 5, __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, 5, __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, 5, __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, 5, __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, 5, __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, 5, __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, 5, __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, 5, __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, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_15 = PyTuple_New(38); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 5, __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->cached_model);
  __Pyx_GIVEREF(__pyx_v_self->cached_model);
  PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_self->cached_model);
  __Pyx_INCREF(__pyx_v_self->cached_texture);
  __Pyx_GIVEREF(__pyx_v_self->cached_texture);
  PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_v_self->cached_texture);
  __Pyx_INCREF(__pyx_v_self->children);
  __Pyx_GIVEREF(__pyx_v_self->children);
  PyTuple_SET_ITEM(__pyx_t_15, 5, __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, 6, __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, 7, __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, 8, __pyx_v_self->focus_screen);
  __Pyx_INCREF(__pyx_v_self->focuses);
  __Pyx_GIVEREF(__pyx_v_self->focuses);
  PyTuple_SET_ITEM(__pyx_t_15, 9, __pyx_v_self->focuses);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->forward));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->forward));
  PyTuple_SET_ITEM(__pyx_t_15, 10, ((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, 11, __pyx_v_self->half_cache);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_15, 12, __pyx_t_3);
  __Pyx_INCREF(__pyx_v_self->layer_name);
  __Pyx_GIVEREF(__pyx_v_self->layer_name);
  PyTuple_SET_ITEM(__pyx_t_15, 13, __pyx_v_self->layer_name);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_15, 14, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_15, 15, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_self->mesh);
  __Pyx_GIVEREF(__pyx_v_self->mesh);
  PyTuple_SET_ITEM(__pyx_t_15, 16, __pyx_v_self->mesh);
  __Pyx_INCREF(__pyx_v_self->modal);
  __Pyx_GIVEREF(__pyx_v_self->modal);
  PyTuple_SET_ITEM(__pyx_t_15, 17, __pyx_v_self->modal);
  __Pyx_INCREF(__pyx_v_self->nearest);
  __Pyx_GIVEREF(__pyx_v_self->nearest);
  PyTuple_SET_ITEM(__pyx_t_15, 18, __pyx_v_self->nearest);
  __Pyx_GIVEREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_15, 19, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_15, 20, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_15, 21, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_15, 22, __pyx_t_9);
  __Pyx_INCREF(__pyx_v_self->operation_parameter);
  __Pyx_GIVEREF(__pyx_v_self->operation_parameter);
  PyTuple_SET_ITEM(__pyx_t_15, 23, __pyx_v_self->operation_parameter);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_15, 24, __pyx_t_10);
  __Pyx_INCREF(__pyx_v_self->parents);
  __Pyx_GIVEREF(__pyx_v_self->parents);
  PyTuple_SET_ITEM(__pyx_t_15, 25, __pyx_v_self->parents);
  __Pyx_INCREF(__pyx_v_self->pass_focuses);
  __Pyx_GIVEREF(__pyx_v_self->pass_focuses);
  PyTuple_SET_ITEM(__pyx_t_15, 26, __pyx_v_self->pass_focuses);
  __Pyx_INCREF(__pyx_v_self->properties);
  __Pyx_GIVEREF(__pyx_v_self->properties);
  PyTuple_SET_ITEM(__pyx_t_15, 27, __pyx_v_self->properties);
  __Pyx_INCREF(__pyx_v_self->render_of);
  __Pyx_GIVEREF(__pyx_v_self->render_of);
  PyTuple_SET_ITEM(__pyx_t_15, 28, __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, 29, ((PyObject *)__pyx_v_self->reverse));
  __Pyx_INCREF(__pyx_v_self->shaders);
  __Pyx_GIVEREF(__pyx_v_self->shaders);
  PyTuple_SET_ITEM(__pyx_t_15, 30, __pyx_v_self->shaders);
  __Pyx_INCREF(__pyx_v_self->surface);
  __Pyx_GIVEREF(__pyx_v_self->surface);
  PyTuple_SET_ITEM(__pyx_t_15, 31, __pyx_v_self->surface);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_15, 32, __pyx_t_11);
  __Pyx_INCREF(__pyx_v_self->uniforms);
  __Pyx_GIVEREF(__pyx_v_self->uniforms);
  PyTuple_SET_ITEM(__pyx_t_15, 33, __pyx_v_self->uniforms);
  __Pyx_INCREF(__pyx_v_self->visible_children);
  __Pyx_GIVEREF(__pyx_v_self->visible_children);
  PyTuple_SET_ITEM(__pyx_t_15, 34, __pyx_v_self->visible_children);
  __Pyx_GIVEREF(__pyx_t_12);
  PyTuple_SET_ITEM(__pyx_t_15, 35, __pyx_t_12);
  __Pyx_GIVEREF(__pyx_t_13);
  PyTuple_SET_ITEM(__pyx_t_15, 36, __pyx_t_13);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_15, 37, __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)":6
 *     cdef bint use_setstate
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.cached_model, self.cached_texture, 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.loaded, self.mark, self.mesh, 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.properties, self.render_of, self.reverse, self.shaders, self.surface, self.text_input, self.uniforms, 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, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_15);
  __pyx_v__dict = __pyx_t_15;
  __pyx_t_15 = 0;

  /* "(tree fragment)":7
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.cached_model, self.cached_texture, 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.loaded, self.mark, self.mesh, 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.properties, self.render_of, self.reverse, self.shaders, self.surface, self.text_input, self.uniforms, 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)":8
 *     _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, 8, __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, 8, __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)":9
 *     if _dict is not None:
 *         state += (_dict,)
 *         use_setstate = True             # <<<<<<<<<<<<<<
 *     else:
 *         use_setstate = self.alpha_surface is not None or self.cached_model is not None or self.cached_texture 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.mesh is not None or self.modal 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.properties is not None or self.render_of is not None or self.reverse is not None or self.shaders is not None or self.surface is not None or self.uniforms is not None or self.visible_children is not None
 */
    __pyx_v_use_setstate = 1;

    /* "(tree fragment)":7
 *     state = (self.alpha, self.alpha_surface, self.cache_killed, self.cached_model, self.cached_texture, 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.loaded, self.mark, self.mesh, 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.properties, self.render_of, self.reverse, self.shaders, self.surface, self.text_input, self.uniforms, 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)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.alpha_surface is not None or self.cached_model is not None or self.cached_texture 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.mesh is not None or self.modal 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.properties is not None or self.render_of is not None or self.reverse is not None or self.shaders is not None or self.surface is not None or self.uniforms is not None or self.visible_children is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, 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->cached_model != 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->cached_texture != 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->mesh != 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->modal != 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->properties != ((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->render_of != 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 = (((PyObject *)__pyx_v_self->reverse) != 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->shaders != ((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->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->uniforms != ((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->visible_children != ((PyObject*)Py_None));
    __pyx_t_16 = (__pyx_t_18 != 0);
    __pyx_t_17 = __pyx_t_16;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_17;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.alpha_surface is not None or self.cached_model is not None or self.cached_texture 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.mesh is not None or self.modal 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.properties is not None or self.render_of is not None or self.reverse is not None or self.shaders is not None or self.surface is not None or self.uniforms is not None or self.visible_children is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, None), state
 *     else:
 */
  __pyx_t_17 = (__pyx_v_use_setstate != 0);
  if (__pyx_t_17) {

    /* "(tree fragment)":13
 *         use_setstate = self.alpha_surface is not None or self.cached_model is not None or self.cached_texture 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.mesh is not None or self.modal 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.properties is not None or self.render_of is not None or self.reverse is not None or self.shaders is not None or self.surface is not None or self.uniforms is not None or self.visible_children is not None
 *     if use_setstate:
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, state)
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_pyx_unpickle_Render); if (unlikely(!__pyx_t_14)) __PYX_ERR(2, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    __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_147483306);
    __Pyx_GIVEREF(__pyx_int_147483306);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_int_147483306);
    __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, 13, __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)":12
 *     else:
 *         use_setstate = self.alpha_surface is not None or self.cached_model is not None or self.cached_texture 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.mesh is not None or self.modal 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.properties is not None or self.render_of is not None or self.reverse is not None or self.shaders is not None or self.surface is not None or self.uniforms is not None or self.visible_children is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, None), state
 *     else:
 */
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, None), state
 *     else:
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_Render__set_state(self, __pyx_state)
 */
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_pyx_unpickle_Render); if (unlikely(!__pyx_t_13)) __PYX_ERR(2, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) __PYX_ERR(2, 15, __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_147483306);
    __Pyx_GIVEREF(__pyx_int_147483306);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_int_147483306);
    __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, 15, __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 tuple state
 *     cdef object _dict
 */

  /* 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)":16
 *     else:
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, 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_57__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_5renpy_7display_6render_6Render_57__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_56__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_56__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":17
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, 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, 17, __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, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_Render, (type(self), 0x8ca6aaa, 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":1516
 * 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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_surf)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 1516, __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, 1516, __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, 1516, __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
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "renpy/display/render.pyx":1517
 * 
 *     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, 1517, __pyx_L1_error)

  /* "renpy/display/render.pyx":1516
 * 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":1519
 *         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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rect", 0, 3, 4, 1); __PYX_ERR(0, 1519, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rect)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rect", 0, 3, 4, 2); __PYX_ERR(0, 1519, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1519, __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, 1519, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("rect", 0);

  /* "renpy/display/render.pyx":1521
 *     def rect(self, color, rect, width=0):
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1522
 * 
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.rect(self.surf,
 *                              renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1522, __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, 1522, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1522, __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":1523
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,             # <<<<<<<<<<<<<<
 *                              renpy.easy.color(color),
 *                              rect,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1523, __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, 1523, __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, 1523, __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, 1523, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1524
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,
 *                              renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                              rect,
 *                              width)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1524, __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, 1524, __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, 1524, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1524, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1526
 *                              renpy.easy.color(color),
 *                              rect,
 *                              width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __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_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __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_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1523, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_rect);
      __Pyx_GIVEREF(__pyx_v_rect);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_rect);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1528
 *                              width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def polygon(self, color, pointlist, width=0):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1528, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1528, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1528, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1528, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1528, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1528, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1519
 *         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_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":1530
 *             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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polygon", 0, 3, 4, 1); __PYX_ERR(0, 1530, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pointlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polygon", 0, 3, 4, 2); __PYX_ERR(0, 1530, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1530, __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, 1530, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("polygon", 0);

  /* "renpy/display/render.pyx":1531
 * 
 *     def polygon(self, color, pointlist, width=0):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1532
 *     def polygon(self, color, pointlist, width=0):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.polygon(self.surf,
 *                                 renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1532, __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, 1532, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1532, __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":1533
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 pointlist,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1533, __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, 1533, __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, 1533, __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, 1533, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1534
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 pointlist,
 *                                 width)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1534, __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, 1534, __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, 1534, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1534, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1536
 *                                 renpy.easy.color(color),
 *                                 pointlist,
 *                                 width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __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_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __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_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1533, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_pointlist);
      __Pyx_GIVEREF(__pyx_v_pointlist);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_pointlist);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1533, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1538
 *                                 width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def circle(self, color, pos, radius, width=0):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1538, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1538, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1538, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1538, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1538, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1530
 *             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_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":1540
 *             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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 1); __PYX_ERR(0, 1540, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 2); __PYX_ERR(0, 1540, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_radius)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 3); __PYX_ERR(0, 1540, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1540, __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, 1540, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("circle", 0);

  /* "renpy/display/render.pyx":1542
 *     def circle(self, color, pos, radius, width=0):
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1543
 * 
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.circle(self.surf,
 *                                renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1543, __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, 1543, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1543, __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":1544
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,             # <<<<<<<<<<<<<<
 *                                renpy.easy.color(color),
 *                                pos,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1544, __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, 1544, __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, 1544, __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, 1544, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1545
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,
 *                                renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                pos,
 *                                radius,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1545, __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, 1545, __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, 1545, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1545, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1548
 *                                pos,
 *                                radius,
 *                                width)             # <<<<<<<<<<<<<<
 * 
 *         finally:
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __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_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1544, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_pos);
      __Pyx_GIVEREF(__pyx_v_pos);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_pos);
      __Pyx_INCREF(__pyx_v_radius);
      __Pyx_GIVEREF(__pyx_v_radius);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_radius);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1544, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1551
 * 
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def ellipse(self, color, rect, width=0):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1551, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1551, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1551, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1551, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1551, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1551, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1540
 *             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_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":1553
 *             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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellipse", 0, 3, 4, 1); __PYX_ERR(0, 1553, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rect)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellipse", 0, 3, 4, 2); __PYX_ERR(0, 1553, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1553, __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, 1553, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("ellipse", 0);

  /* "renpy/display/render.pyx":1554
 * 
 *     def ellipse(self, color, rect, width=0):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1555
 *     def ellipse(self, color, rect, width=0):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.ellipse(self.surf,
 *                                 renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1555, __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, 1555, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1555, __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":1556
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 rect,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1556, __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, 1556, __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, 1556, __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, 1556, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1557
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 rect,
 *                                 width)
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1557, __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, 1557, __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, 1557, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1557, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1559
 *                                 renpy.easy.color(color),
 *                                 rect,
 *                                 width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __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_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __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_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1556, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_rect);
      __Pyx_GIVEREF(__pyx_v_rect);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_rect);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1556, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1561
 *                                 width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1561, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1561, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1561, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1561, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1561, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1561, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1553
 *             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_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":1564
 * 
 * 
 *     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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 1); __PYX_ERR(0, 1564, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rect)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 2); __PYX_ERR(0, 1564, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_angle)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 3); __PYX_ERR(0, 1564, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_stop_angle)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 4); __PYX_ERR(0, 1564, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  5:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1564, __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, 1564, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("arc", 0);

  /* "renpy/display/render.pyx":1565
 * 
 *     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":1566
 *     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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1566, __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, 1566, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1566, __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":1567
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.arc(self.surf,             # <<<<<<<<<<<<<<
 *                             renpy.easy.color(color),
 *                             rect,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1567, __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, 1567, __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, 1567, __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, 1567, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1568
 *             blit_lock.acquire()
 *             pygame.draw.arc(self.surf,
 *                             renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                             rect,
 *                             start_angle,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1568, __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, 1568, __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, 1568, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1568, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1572
 *                             start_angle,
 *                             stop_angle,
 *                             width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1567, __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_7, 6+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1567, __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_6 = PyTuple_New(6+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1567, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_rect);
      __Pyx_GIVEREF(__pyx_v_rect);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_rect);
      __Pyx_INCREF(__pyx_v_start_angle);
      __Pyx_GIVEREF(__pyx_v_start_angle);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_start_angle);
      __Pyx_INCREF(__pyx_v_stop_angle);
      __Pyx_GIVEREF(__pyx_v_stop_angle);
      PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_stop_angle);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_7, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1567, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1574
 *                             width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1574, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1574, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1574, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1574, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1574, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1574, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1564
 * 
 * 
 *     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_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":1577
 * 
 * 
 *     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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 1); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_start_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 2); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_end_pos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 3); __PYX_ERR(0, 1577, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1577, __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, 1577, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("line", 0);

  /* "renpy/display/render.pyx":1578
 * 
 *     def line(self, color, start_pos, end_pos, width=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1579
 *     def line(self, color, start_pos, end_pos, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.line(self.surf,
 *                              renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1579, __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, 1579, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1579, __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":1580
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,             # <<<<<<<<<<<<<<
 *                              renpy.easy.color(color),
 *                              start_pos,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1580, __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, 1580, __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, 1580, __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, 1580, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1581
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,
 *                              renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                              start_pos,
 *                              end_pos,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1581, __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, 1581, __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, 1581, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1581, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1584
 *                              start_pos,
 *                              end_pos,
 *                              width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1580, __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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1580, __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_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1580, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_start_pos);
      __Pyx_GIVEREF(__pyx_v_start_pos);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_start_pos);
      __Pyx_INCREF(__pyx_v_end_pos);
      __Pyx_GIVEREF(__pyx_v_end_pos);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_end_pos);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1580, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1586
 *                              width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def lines(self, color, closed, pointlist, width=1):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1586, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1586, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1586, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1586, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1577
 * 
 * 
 *     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_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":1588
 *             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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 1); __PYX_ERR(0, 1588, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_closed)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 2); __PYX_ERR(0, 1588, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pointlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 3); __PYX_ERR(0, 1588, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1588, __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, 1588, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("lines", 0);

  /* "renpy/display/render.pyx":1589
 * 
 *     def lines(self, color, closed, pointlist, width=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1590
 *     def lines(self, color, closed, pointlist, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.lines(self.surf,
 *                               renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1590, __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, 1590, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1590, __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":1591
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,             # <<<<<<<<<<<<<<
 *                               renpy.easy.color(color),
 *                               closed,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1591, __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, 1591, __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, 1591, __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, 1591, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1592
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,
 *                               renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                               closed,
 *                               pointlist,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1592, __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, 1592, __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, 1592, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1592, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1595
 *                               closed,
 *                               pointlist,
 *                               width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __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_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1591, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_closed);
      __Pyx_GIVEREF(__pyx_v_closed);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_closed);
      __Pyx_INCREF(__pyx_v_pointlist);
      __Pyx_GIVEREF(__pyx_v_pointlist);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_pointlist);
      __Pyx_INCREF(__pyx_v_width);
      __Pyx_GIVEREF(__pyx_v_width);
      PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_width);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1591, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1597
 *                               width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1597, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1597, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1597, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1597, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1597, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1588
 *             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_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":1599
 *             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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 1); __PYX_ERR(0, 1599, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_startpos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 2); __PYX_ERR(0, 1599, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_endpos)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 3); __PYX_ERR(0, 1599, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1599, __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, 1599, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("aaline", 0);

  /* "renpy/display/render.pyx":1600
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1601
 *     def aaline(self, color, startpos, endpos, blend=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.aaline(self.surf,
 *                                renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1601, __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, 1601, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1601, __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":1602
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,             # <<<<<<<<<<<<<<
 *                                renpy.easy.color(color),
 *                                startpos,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1602, __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, 1602, __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, 1602, __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, 1602, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1603
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,
 *                                renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                startpos,
 *                                endpos,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1603, __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, 1603, __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, 1603, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1603, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1606
 *                                startpos,
 *                                endpos,
 *                                blend)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __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_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1602, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_startpos);
      __Pyx_GIVEREF(__pyx_v_startpos);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_startpos);
      __Pyx_INCREF(__pyx_v_endpos);
      __Pyx_GIVEREF(__pyx_v_endpos);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_endpos);
      __Pyx_INCREF(__pyx_v_blend);
      __Pyx_GIVEREF(__pyx_v_blend);
      PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_blend);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1602, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1608
 *                                blend)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1608, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1608, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1608, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1608, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1608, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1599
 *             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_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":1610
 *             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)(void*)(PyCFunctionWithKeywords)__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 1); __PYX_ERR(0, 1610, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_closed)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 2); __PYX_ERR(0, 1610, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  3:
        if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pointlist)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 3); __PYX_ERR(0, 1610, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  4:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__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, 1610, __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, 1610, __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;
  int __pyx_t_7;
  int __pyx_t_8;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("aalines", 0);

  /* "renpy/display/render.pyx":1611
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1612
 *     def aalines(self, color, closed, pointlist, blend=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.aalines(self.surf,
 *                                 renpy.easy.color(color),
 */
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1612, __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, 1612, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1612, __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":1613
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 closed,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pygame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1613, __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, 1613, __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, 1613, __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, 1613, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1614
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 closed,
 *                                 pointlist,
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_renpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1614, __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, 1614, __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, 1614, __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);
      }
    }
    __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_v_color) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_color);
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1614, __pyx_L4_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":1617
 *                                 closed,
 *                                 pointlist,
 *                                 blend)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_5 = NULL;
    __pyx_t_7 = 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_7 = 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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1613, __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_7, 5+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1613, __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_6 = PyTuple_New(5+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1613, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_6);
      if (__pyx_t_5) {
        __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
      }
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_t_4);
      __Pyx_INCREF(__pyx_v_closed);
      __Pyx_GIVEREF(__pyx_v_closed);
      PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_closed);
      __Pyx_INCREF(__pyx_v_pointlist);
      __Pyx_GIVEREF(__pyx_v_pointlist);
      PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_pointlist);
      __Pyx_INCREF(__pyx_v_blend);
      __Pyx_GIVEREF(__pyx_v_blend);
      PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_blend);
      __pyx_t_2 = 0;
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1613, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":1619
 *                                 blend)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def get_surface(self):
 */
  /*finally:*/ {
    /*normal exit:*/{
      __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_release); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1619, __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 && unlikely(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);
        }
      }
      __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_6);
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1619, __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;
      goto __pyx_L5;
    }
    __pyx_L4_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12) < 0)) __Pyx_ErrFetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __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_t_7 = __pyx_lineno; __pyx_t_8 = __pyx_clineno; __pyx_t_9 = __pyx_filename;
      {
        __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_blit_lock); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1619, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_release); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1619, __pyx_L7_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = NULL;
        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_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1619, __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_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ErrRestore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_8; __pyx_filename = __pyx_t_9;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_13);
        __Pyx_XGIVEREF(__pyx_t_14);
        __Pyx_XGIVEREF(__pyx_t_15);
        __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "renpy/display/render.pyx":1610
 *             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_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":1621
 *             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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_surface", 0);

  /* "renpy/display/render.pyx":1622
 * 
 *     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, 1622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "renpy/display/render.pyx":1621
 *             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_Render(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_7display_6render_35__pyx_unpickle_Render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_35__pyx_unpickle_Render = {"__pyx_unpickle_Render", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_35__pyx_unpickle_Render, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5renpy_7display_6render_35__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__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] = __Pyx_PyDict_GetItemStr(__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_34__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_34__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 = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Render", 0);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x8ca6aaa:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 */
  __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x8ca6aaa) != 0);
  if (__pyx_t_1) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x8ca6aaa:
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, 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, 5, __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, 5, __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, 5, __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)":6
 *     if __pyx_checksum != 0x8ca6aaa:
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, 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, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x8c, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __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);
      }
    }
    __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum != 0x8ca6aaa:             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, visible_children, width, xclipping, yclipping))" % __pyx_checksum)
 */
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, 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, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v___pyx_result = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, 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_6 = (__pyx_t_1 != 0);
  if (__pyx_t_6) {

    /* "(tree fragment)":9
 *     __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, 9, __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, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError("Incompatible checksums (%s vs 0x8ca6aaa = (alpha, alpha_surface, cache_killed, cached_model, cached_texture, children, depends_on_list, draw_func, focus_screen, focuses, forward, half_cache, height, layer_name, loaded, mark, mesh, modal, nearest, opaque, operation, operation_alpha, operation_complete, operation_parameter, over, parents, pass_focuses, properties, render_of, reverse, shaders, surface, text_input, uniforms, 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)":10
 *     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.cached_model = __pyx_state[3]; __pyx_result.cached_texture = __pyx_state[4]; __pyx_result.children = __pyx_state[5]; __pyx_result.depends_on_list = __pyx_state[6]; __pyx_result.draw_func = __pyx_state[7]; __pyx_result.focus_screen = __pyx_state[8]; __pyx_result.focuses = __pyx_state[9]; __pyx_result.forward = __pyx_state[10]; __pyx_result.half_cache = __pyx_state[11]; __pyx_result.height = __pyx_state[12]; __pyx_result.layer_name = __pyx_state[13]; __pyx_result.loaded = __pyx_state[14]; __pyx_result.mark = __pyx_state[15]; __pyx_result.mesh = __pyx_state[16]; __pyx_result.modal = __pyx_state[17]; __pyx_result.nearest = __pyx_state[18]; __pyx_result.opaque = __pyx_state[19]; __pyx_result.operation = __pyx_state[20]; __pyx_result.operation_alpha = __pyx_state[21]; __pyx_result.operation_complete = __pyx_state[22]; __pyx_result.operation_parameter = __pyx_state[23]; __pyx_result.over = __pyx_state[24]; __pyx_result.parents = __pyx_state[25]; __pyx_result.pass_focuses = __pyx_state[26]; __pyx_result.properties = __pyx_state[27]; __pyx_result.render_of = __pyx_state[28]; __pyx_result.reverse = __pyx_state[29]; __pyx_result.shaders = __pyx_state[30]; __pyx_result.surface = __pyx_state[31]; __pyx_result.text_input = __pyx_state[32]; __pyx_result.uniforms = __pyx_state[33]; __pyx_result.visible_children = __pyx_state[34]; __pyx_result.width = __pyx_state[35]; __pyx_result.xclipping = __pyx_state[36]; __pyx_result.yclipping = __pyx_state[37]
 */
  __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):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */

  /* 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_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)":11
 *         __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.cached_model = __pyx_state[3]; __pyx_result.cached_texture = __pyx_state[4]; __pyx_result.children = __pyx_state[5]; __pyx_result.depends_on_list = __pyx_state[6]; __pyx_result.draw_func = __pyx_state[7]; __pyx_result.focus_screen = __pyx_state[8]; __pyx_result.focuses = __pyx_state[9]; __pyx_result.forward = __pyx_state[10]; __pyx_result.half_cache = __pyx_state[11]; __pyx_result.height = __pyx_state[12]; __pyx_result.layer_name = __pyx_state[13]; __pyx_result.loaded = __pyx_state[14]; __pyx_result.mark = __pyx_state[15]; __pyx_result.mesh = __pyx_state[16]; __pyx_result.modal = __pyx_state[17]; __pyx_result.nearest = __pyx_state[18]; __pyx_result.opaque = __pyx_state[19]; __pyx_result.operation = __pyx_state[20]; __pyx_result.operation_alpha = __pyx_state[21]; __pyx_result.operation_complete = __pyx_state[22]; __pyx_result.operation_parameter = __pyx_state[23]; __pyx_result.over = __pyx_state[24]; __pyx_result.parents = __pyx_state[25]; __pyx_result.pass_focuses = __pyx_state[26]; __pyx_result.properties = __pyx_state[27]; __pyx_result.render_of = __pyx_state[28]; __pyx_result.reverse = __pyx_state[29]; __pyx_result.shaders = __pyx_state[30]; __pyx_result.surface = __pyx_state[31]; __pyx_result.text_input = __pyx_state[32]; __pyx_result.uniforms = __pyx_state[33]; __pyx_result.visible_children = __pyx_state[34]; __pyx_result.width = __pyx_state[35]; __pyx_result.xclipping = __pyx_state[36]; __pyx_result.yclipping = __pyx_state[37]
 *     if len(__pyx_state) > 38 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__pyx_unpickle_Render__set_state", 0);

  /* "(tree fragment)":12
 *     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.cached_model = __pyx_state[3]; __pyx_result.cached_texture = __pyx_state[4]; __pyx_result.children = __pyx_state[5]; __pyx_result.depends_on_list = __pyx_state[6]; __pyx_result.draw_func = __pyx_state[7]; __pyx_result.focus_screen = __pyx_state[8]; __pyx_result.focuses = __pyx_state[9]; __pyx_result.forward = __pyx_state[10]; __pyx_result.half_cache = __pyx_state[11]; __pyx_result.height = __pyx_state[12]; __pyx_result.layer_name = __pyx_state[13]; __pyx_result.loaded = __pyx_state[14]; __pyx_result.mark = __pyx_state[15]; __pyx_result.mesh = __pyx_state[16]; __pyx_result.modal = __pyx_state[17]; __pyx_result.nearest = __pyx_state[18]; __pyx_result.opaque = __pyx_state[19]; __pyx_result.operation = __pyx_state[20]; __pyx_result.operation_alpha = __pyx_state[21]; __pyx_result.operation_complete = __pyx_state[22]; __pyx_result.operation_parameter = __pyx_state[23]; __pyx_result.over = __pyx_state[24]; __pyx_result.parents = __pyx_state[25]; __pyx_result.pass_focuses = __pyx_state[26]; __pyx_result.properties = __pyx_state[27]; __pyx_result.render_of = __pyx_state[28]; __pyx_result.reverse = __pyx_state[29]; __pyx_result.shaders = __pyx_state[30]; __pyx_result.surface = __pyx_state[31]; __pyx_result.text_input = __pyx_state[32]; __pyx_result.uniforms = __pyx_state[33]; __pyx_result.visible_children = __pyx_state[34]; __pyx_result.width = __pyx_state[35]; __pyx_result.xclipping = __pyx_state[36]; __pyx_result.yclipping = __pyx_state[37]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 38 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[38])
 */
  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_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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->cached_model);
  __Pyx_DECREF(__pyx_v___pyx_result->cached_model);
  __pyx_v___pyx_result->cached_model = __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->cached_texture);
  __Pyx_DECREF(__pyx_v___pyx_result->cached_texture);
  __pyx_v___pyx_result->cached_texture = __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(2, 12, __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_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->loaded = __pyx_t_3;
  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_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, 12, __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, 12, __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->mesh);
  __Pyx_DECREF(__pyx_v___pyx_result->mesh);
  __pyx_v___pyx_result->mesh = __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->modal);
  __Pyx_DECREF(__pyx_v___pyx_result->modal);
  __pyx_v___pyx_result->modal = __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->properties);
  __Pyx_DECREF(__pyx_v___pyx_result->properties);
  __pyx_v___pyx_result->properties = ((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, 12, __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, 12, __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, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_7display_6matrix_Matrix))))) __PYX_ERR(2, 12, __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_6matrix_Matrix *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(2, 12, __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, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->shaders);
  __Pyx_DECREF(__pyx_v___pyx_result->shaders);
  __pyx_v___pyx_result->shaders = ((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, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 31, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __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, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 32, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __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, 12, __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, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 33, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(2, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->uniforms);
  __Pyx_DECREF(__pyx_v___pyx_result->uniforms);
  __pyx_v___pyx_result->uniforms = ((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, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 34, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __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, 12, __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, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 35, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __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, 12, __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, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 36, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __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, 12, __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, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __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, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->yclipping = __pyx_t_3;

  /* "(tree fragment)":13
 * 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.cached_model = __pyx_state[3]; __pyx_result.cached_texture = __pyx_state[4]; __pyx_result.children = __pyx_state[5]; __pyx_result.depends_on_list = __pyx_state[6]; __pyx_result.draw_func = __pyx_state[7]; __pyx_result.focus_screen = __pyx_state[8]; __pyx_result.focuses = __pyx_state[9]; __pyx_result.forward = __pyx_state[10]; __pyx_result.half_cache = __pyx_state[11]; __pyx_result.height = __pyx_state[12]; __pyx_result.layer_name = __pyx_state[13]; __pyx_result.loaded = __pyx_state[14]; __pyx_result.mark = __pyx_state[15]; __pyx_result.mesh = __pyx_state[16]; __pyx_result.modal = __pyx_state[17]; __pyx_result.nearest = __pyx_state[18]; __pyx_result.opaque = __pyx_state[19]; __pyx_result.operation = __pyx_state[20]; __pyx_result.operation_alpha = __pyx_state[21]; __pyx_result.operation_complete = __pyx_state[22]; __pyx_result.operation_parameter = __pyx_state[23]; __pyx_result.over = __pyx_state[24]; __pyx_result.parents = __pyx_state[25]; __pyx_result.pass_focuses = __pyx_state[26]; __pyx_result.properties = __pyx_state[27]; __pyx_result.render_of = __pyx_state[28]; __pyx_result.reverse = __pyx_state[29]; __pyx_result.shaders = __pyx_state[30]; __pyx_result.surface = __pyx_state[31]; __pyx_result.text_input = __pyx_state[32]; __pyx_result.uniforms = __pyx_state[33]; __pyx_result.visible_children = __pyx_state[34]; __pyx_result.width = __pyx_state[35]; __pyx_result.xclipping = __pyx_state[36]; __pyx_result.yclipping = __pyx_state[37]
 *     if len(__pyx_state) > 38 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[38])
 */
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(2, 13, __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, 13, __pyx_L1_error)
  __pyx_t_7 = ((__pyx_t_6 > 38) != 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, 13, __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)":14
 *     __pyx_result.alpha = __pyx_state[0]; __pyx_result.alpha_surface = __pyx_state[1]; __pyx_result.cache_killed = __pyx_state[2]; __pyx_result.cached_model = __pyx_state[3]; __pyx_result.cached_texture = __pyx_state[4]; __pyx_result.children = __pyx_state[5]; __pyx_result.depends_on_list = __pyx_state[6]; __pyx_result.draw_func = __pyx_state[7]; __pyx_result.focus_screen = __pyx_state[8]; __pyx_result.focuses = __pyx_state[9]; __pyx_result.forward = __pyx_state[10]; __pyx_result.half_cache = __pyx_state[11]; __pyx_result.height = __pyx_state[12]; __pyx_result.layer_name = __pyx_state[13]; __pyx_result.loaded = __pyx_state[14]; __pyx_result.mark = __pyx_state[15]; __pyx_result.mesh = __pyx_state[16]; __pyx_result.modal = __pyx_state[17]; __pyx_result.nearest = __pyx_state[18]; __pyx_result.opaque = __pyx_state[19]; __pyx_result.operation = __pyx_state[20]; __pyx_result.operation_alpha = __pyx_state[21]; __pyx_result.operation_complete = __pyx_state[22]; __pyx_result.operation_parameter = __pyx_state[23]; __pyx_result.over = __pyx_state[24]; __pyx_result.parents = __pyx_state[25]; __pyx_result.pass_focuses = __pyx_state[26]; __pyx_result.properties = __pyx_state[27]; __pyx_result.render_of = __pyx_state[28]; __pyx_result.reverse = __pyx_state[29]; __pyx_result.shaders = __pyx_state[30]; __pyx_result.surface = __pyx_state[31]; __pyx_result.text_input = __pyx_state[32]; __pyx_result.uniforms = __pyx_state[33]; __pyx_result.visible_children = __pyx_state[34]; __pyx_result.width = __pyx_state[35]; __pyx_result.xclipping = __pyx_state[36]; __pyx_result.yclipping = __pyx_state[37]
 *     if len(__pyx_state) > 38 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[38])             # <<<<<<<<<<<<<<
 */
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 14, __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, 14, __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, 14, __pyx_L1_error)
    }
    __pyx_t_9 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 38, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 14, __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);
      }
    }
    __pyx_t_1 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_11, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_9);
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * 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.cached_model = __pyx_state[3]; __pyx_result.cached_texture = __pyx_state[4]; __pyx_result.children = __pyx_state[5]; __pyx_result.depends_on_list = __pyx_state[6]; __pyx_result.draw_func = __pyx_state[7]; __pyx_result.focus_screen = __pyx_state[8]; __pyx_result.focuses = __pyx_state[9]; __pyx_result.forward = __pyx_state[10]; __pyx_result.half_cache = __pyx_state[11]; __pyx_result.height = __pyx_state[12]; __pyx_result.layer_name = __pyx_state[13]; __pyx_result.loaded = __pyx_state[14]; __pyx_result.mark = __pyx_state[15]; __pyx_result.mesh = __pyx_state[16]; __pyx_result.modal = __pyx_state[17]; __pyx_result.nearest = __pyx_state[18]; __pyx_result.opaque = __pyx_state[19]; __pyx_result.operation = __pyx_state[20]; __pyx_result.operation_alpha = __pyx_state[21]; __pyx_result.operation_complete = __pyx_state[22]; __pyx_result.operation_parameter = __pyx_state[23]; __pyx_result.over = __pyx_state[24]; __pyx_result.parents = __pyx_state[25]; __pyx_result.pass_focuses = __pyx_state[26]; __pyx_result.properties = __pyx_state[27]; __pyx_result.render_of = __pyx_state[28]; __pyx_result.reverse = __pyx_state[29]; __pyx_result.shaders = __pyx_state[30]; __pyx_result.surface = __pyx_state[31]; __pyx_result.text_input = __pyx_state[32]; __pyx_result.uniforms = __pyx_state[33]; __pyx_result.visible_children = __pyx_state[34]; __pyx_result.width = __pyx_state[35]; __pyx_result.xclipping = __pyx_state[36]; __pyx_result.yclipping = __pyx_state[37]
 *     if len(__pyx_state) > 38 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[38])
 */
  }

  /* "(tree fragment)":11
 *         __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.cached_model = __pyx_state[3]; __pyx_result.cached_texture = __pyx_state[4]; __pyx_result.children = __pyx_state[5]; __pyx_result.depends_on_list = __pyx_state[6]; __pyx_result.draw_func = __pyx_state[7]; __pyx_result.focus_screen = __pyx_state[8]; __pyx_result.focuses = __pyx_state[9]; __pyx_result.forward = __pyx_state[10]; __pyx_result.half_cache = __pyx_state[11]; __pyx_result.height = __pyx_state[12]; __pyx_result.layer_name = __pyx_state[13]; __pyx_result.loaded = __pyx_state[14]; __pyx_result.mark = __pyx_state[15]; __pyx_result.mesh = __pyx_state[16]; __pyx_result.modal = __pyx_state[17]; __pyx_result.nearest = __pyx_state[18]; __pyx_result.opaque = __pyx_state[19]; __pyx_result.operation = __pyx_state[20]; __pyx_result.operation_alpha = __pyx_state[21]; __pyx_result.operation_complete = __pyx_state[22]; __pyx_result.operation_parameter = __pyx_state[23]; __pyx_result.over = __pyx_state[24]; __pyx_result.parents = __pyx_state[25]; __pyx_result.pass_focuses = __pyx_state[26]; __pyx_result.properties = __pyx_state[27]; __pyx_result.render_of = __pyx_state[28]; __pyx_result.reverse = __pyx_state[29]; __pyx_result.shaders = __pyx_state[30]; __pyx_result.surface = __pyx_state[31]; __pyx_result.text_input = __pyx_state[32]; __pyx_result.uniforms = __pyx_state[33]; __pyx_result.visible_children = __pyx_state[34]; __pyx_result.width = __pyx_state[35]; __pyx_result.xclipping = __pyx_state[36]; __pyx_result.yclipping = __pyx_state[37]
 *     if len(__pyx_state) > 38 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_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;
}

/* "renpy/display/matrix.pxd":31
 *     cdef Matrix inverse_cache
 * 
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform4(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float *__pyx_v_ow, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transform4", 0);

  /* "renpy/display/matrix.pxd":32
 * 
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw             # <<<<<<<<<<<<<<
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 */
  (__pyx_v_ox[0]) = ((((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy)) + (__pyx_v_z * __pyx_v_self->xdz)) + (__pyx_v_w * __pyx_v_self->xdw));

  /* "renpy/display/matrix.pxd":33
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw             # <<<<<<<<<<<<<<
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 */
  (__pyx_v_oy[0]) = ((((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy)) + (__pyx_v_z * __pyx_v_self->ydz)) + (__pyx_v_w * __pyx_v_self->ydw));

  /* "renpy/display/matrix.pxd":34
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw             # <<<<<<<<<<<<<<
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 * 
 */
  (__pyx_v_oz[0]) = ((((__pyx_v_x * __pyx_v_self->zdx) + (__pyx_v_y * __pyx_v_self->zdy)) + (__pyx_v_z * __pyx_v_self->zdz)) + (__pyx_v_w * __pyx_v_self->zdw));

  /* "renpy/display/matrix.pxd":35
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw             # <<<<<<<<<<<<<<
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):
 */
  (__pyx_v_ow[0]) = ((((__pyx_v_x * __pyx_v_self->wdx) + (__pyx_v_y * __pyx_v_self->wdy)) + (__pyx_v_z * __pyx_v_self->wdz)) + (__pyx_v_w * __pyx_v_self->wdw));

  /* "renpy/display/matrix.pxd":31
 *     cdef Matrix inverse_cache
 * 
 *     cdef inline void transform4(Matrix self, float *ox, float *oy, float *oz, float *ow, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

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

/* "renpy/display/matrix.pxd":37
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform3(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float *__pyx_v_oz, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transform3", 0);

  /* "renpy/display/matrix.pxd":38
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw             # <<<<<<<<<<<<<<
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 */
  (__pyx_v_ox[0]) = ((((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy)) + (__pyx_v_z * __pyx_v_self->xdz)) + (__pyx_v_w * __pyx_v_self->xdw));

  /* "renpy/display/matrix.pxd":39
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw             # <<<<<<<<<<<<<<
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 */
  (__pyx_v_oy[0]) = ((((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy)) + (__pyx_v_z * __pyx_v_self->ydz)) + (__pyx_v_w * __pyx_v_self->ydw));

  /* "renpy/display/matrix.pxd":40
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw             # <<<<<<<<<<<<<<
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):
 */
  (__pyx_v_oz[0]) = ((((__pyx_v_x * __pyx_v_self->zdx) + (__pyx_v_y * __pyx_v_self->zdy)) + (__pyx_v_z * __pyx_v_self->zdz)) + (__pyx_v_w * __pyx_v_self->zdw));

  /* "renpy/display/matrix.pxd":37
 *         ow[0] = x * self.wdx + y * self.wdy + z * self.wdz + w * self.wdw
 * 
 *     cdef inline void transform3(Matrix self, float *ox, float *oy, float *oz, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

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

/* "renpy/display/matrix.pxd":42
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

static CYTHON_INLINE void __pyx_f_5renpy_7display_6matrix_6Matrix_transform2(struct __pyx_obj_5renpy_7display_6matrix_Matrix *__pyx_v_self, float *__pyx_v_ox, float *__pyx_v_oy, float __pyx_v_x, float __pyx_v_y, float __pyx_v_z, float __pyx_v_w) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("transform2", 0);

  /* "renpy/display/matrix.pxd":43
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw             # <<<<<<<<<<<<<<
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 * 
 */
  (__pyx_v_ox[0]) = ((((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy)) + (__pyx_v_z * __pyx_v_self->xdz)) + (__pyx_v_w * __pyx_v_self->xdw));

  /* "renpy/display/matrix.pxd":44
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw             # <<<<<<<<<<<<<<
 * 
 *     cpdef bint is_unit_aligned(Matrix self)
 */
  (__pyx_v_oy[0]) = ((((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy)) + (__pyx_v_z * __pyx_v_self->ydz)) + (__pyx_v_w * __pyx_v_self->ydw));

  /* "renpy/display/matrix.pxd":42
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}
static struct __pyx_vtabstruct_5renpy_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_6matrix_Matrix *)Py_None); Py_INCREF(Py_None);
  p->reverse = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)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);
  p->modal = Py_None; Py_INCREF(Py_None);
  p->mesh = Py_None; Py_INCREF(Py_None);
  p->shaders = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->uniforms = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->properties = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->cached_texture = Py_None; Py_INCREF(Py_None);
  p->cached_model = 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_CLEAR(p->modal);
  Py_CLEAR(p->mesh);
  Py_CLEAR(p->shaders);
  Py_CLEAR(p->uniforms);
  Py_CLEAR(p->properties);
  Py_CLEAR(p->cached_texture);
  Py_CLEAR(p->cached_model);
  (*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;
  }
  if (p->modal) {
    e = (*v)(p->modal, a); if (e) return e;
  }
  if (p->mesh) {
    e = (*v)(p->mesh, a); if (e) return e;
  }
  if (p->shaders) {
    e = (*v)(p->shaders, a); if (e) return e;
  }
  if (p->uniforms) {
    e = (*v)(p->uniforms, a); if (e) return e;
  }
  if (p->properties) {
    e = (*v)(p->properties, a); if (e) return e;
  }
  if (p->cached_texture) {
    e = (*v)(p->cached_texture, a); if (e) return e;
  }
  if (p->cached_model) {
    e = (*v)(p->cached_model, 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_6matrix_Matrix *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->reverse);
  p->reverse = ((struct __pyx_obj_5renpy_7display_6matrix_Matrix *)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);
  tmp = ((PyObject*)p->modal);
  p->modal = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mesh);
  p->mesh = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->shaders);
  p->shaders = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->uniforms);
  p->uniforms = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->properties);
  p->properties = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->cached_texture);
  p->cached_texture = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->cached_model);
  p->cached_model = 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 {
    return __pyx_pw_5renpy_7display_6render_6Render_5modal_5__del__(o);
  }
}

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 PyObject *__pyx_getprop_5renpy_7display_6render_6Render_mesh(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_4mesh_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_mesh(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_4mesh_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_4mesh_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_shaders(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_7shaders_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_shaders(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_7shaders_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_7shaders_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_uniforms(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_8uniforms_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_uniforms(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_8uniforms_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_8uniforms_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_properties(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_10properties_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_properties(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_10properties_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_10properties_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_cached_texture(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_14cached_texture_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_cached_texture(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_14cached_texture_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_14cached_texture_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_cached_model(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_12cached_model_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_cached_model(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_12cached_model_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_7display_6render_6Render_12cached_model_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_loaded(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_7display_6render_6Render_6loaded_1__get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_loaded(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_7display_6render_6Render_6loaded_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)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_9blit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_8blit},
  {"subpixel_blit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_11subpixel_blit, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_10subpixel_blit},
  {"absolute_blit", (PyCFunction)(void*)(PyCFunctionWithKeywords)__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)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_17render_to_texture, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_16render_to_texture},
  {"subsurface", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_19subsurface, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_18subsurface},
  {"depends_on", (PyCFunction)(void*)(PyCFunctionWithKeywords)__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)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_27add_focus, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_26add_focus},
  {"take_focuses", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_29take_focuses, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_28take_focuses},
  {"focus_at_point", (PyCFunction)(void*)(PyCFunctionWithKeywords)__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)(void*)(PyCFunctionWithKeywords)__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)(void*)(PyCFunctionWithKeywords)__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)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_43screen_rect, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_42screen_rect},
  {"place", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_45place, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_44place},
  {"zoom", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_47zoom, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_46zoom},
  {"add_shader", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_49add_shader, METH_O, __pyx_doc_5renpy_7display_6render_6Render_48add_shader},
  {"add_uniform", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_51add_uniform, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_50add_uniform},
  {"add_property", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5renpy_7display_6render_6Render_53add_property, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5renpy_7display_6render_6Render_52add_property},
  {"__reduce_cython__", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_55__reduce_cython__, METH_NOARGS, 0},
  {"__setstate_cython__", (PyCFunction)__pyx_pw_5renpy_7display_6render_6Render_57__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},
  {(char *)"mesh", __pyx_getprop_5renpy_7display_6render_6Render_mesh, __pyx_setprop_5renpy_7display_6render_6Render_mesh, (char *)0, 0},
  {(char *)"shaders", __pyx_getprop_5renpy_7display_6render_6Render_shaders, __pyx_setprop_5renpy_7display_6render_6Render_shaders, (char *)0, 0},
  {(char *)"uniforms", __pyx_getprop_5renpy_7display_6render_6Render_uniforms, __pyx_setprop_5renpy_7display_6render_6Render_uniforms, (char *)0, 0},
  {(char *)"properties", __pyx_getprop_5renpy_7display_6render_6Render_properties, __pyx_setprop_5renpy_7display_6render_6Render_properties, (char *)0, 0},
  {(char *)"cached_texture", __pyx_getprop_5renpy_7display_6render_6Render_cached_texture, __pyx_setprop_5renpy_7display_6render_6Render_cached_texture, (char *)0, 0},
  {(char *)"cached_model", __pyx_getprop_5renpy_7display_6render_6Render_cached_model, __pyx_setprop_5renpy_7display_6render_6Render_cached_model, (char *)0, 0},
  {(char *)"loaded", __pyx_getprop_5renpy_7display_6render_6Render_loaded, __pyx_setprop_5renpy_7display_6render_6Render_loaded, (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*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  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
  #if PY_VERSION_HEX >= 0x030800b1
  0, /*tp_vectorcall*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  0, /*tp_print*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {"render", (PyCFunction)(void*)(PyCFunctionWithKeywords)__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
#ifndef CYTHON_SMALL_CODE
#if defined(__clang__)
    #define CYTHON_SMALL_CODE
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
    #define CYTHON_SMALL_CODE __attribute__((cold))
#else
    #define CYTHON_SMALL_CODE
#endif
#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_FLATTEN, __pyx_k_FLATTEN, sizeof(__pyx_k_FLATTEN), 0, 0, 1, 1},
  {&__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_0x8c, __pyx_k_Incompatible_checksums_s_vs_0x8c, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x8c), 0, 0, 1, 0},
  {&__pyx_n_s_Matrix, __pyx_k_Matrix, sizeof(__pyx_k_Matrix), 0, 0, 1, 1},
  {&__pyx_n_s_Matrix2D, __pyx_k_Matrix2D, sizeof(__pyx_k_Matrix2D), 0, 0, 1, 1},
  {&__pyx_n_s_Modal, __pyx_k_Modal, sizeof(__pyx_k_Modal), 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_n_s_Render, __pyx_k_Render, sizeof(__pyx_k_Render), 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_Surface, __pyx_k_Surface, sizeof(__pyx_k_Surface), 0, 0, 1, 1},
  {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0},
  {&__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_check_modal, __pyx_k_check_modal, sizeof(__pyx_k_check_modal), 0, 0, 1, 1},
  {&__pyx_n_s_check_redraws, __pyx_k_check_redraws, sizeof(__pyx_k_check_redraws), 0, 0, 1, 1},
  {&__pyx_n_s_check_redraws_locals_lambda, __pyx_k_check_redraws_locals_lambda, sizeof(__pyx_k_check_redraws_locals_lambda), 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_kp_s_dead, __pyx_k_dead, sizeof(__pyx_k_dead), 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_garbage, __pyx_k_garbage, sizeof(__pyx_k_garbage), 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_gl, __pyx_k_gl, sizeof(__pyx_k_gl), 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_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_key, __pyx_k_key, sizeof(__pyx_k_key), 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_layout, __pyx_k_layout, sizeof(__pyx_k_layout), 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_load_texture, __pyx_k_load_texture, sizeof(__pyx_k_load_texture), 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_models, __pyx_k_models, sizeof(__pyx_k_models), 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_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 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_sizing, __pyx_k_old_sizing, sizeof(__pyx_k_old_sizing), 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_orig_wh, __pyx_k_orig_wh, sizeof(__pyx_k_orig_wh), 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_process_redraws_locals_lambda, __pyx_k_process_redraws_locals_lambda, sizeof(__pyx_k_process_redraws_locals_lambda), 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_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_cache_d, __pyx_k_render_cache_d, sizeof(__pyx_k_render_cache_d), 0, 0, 1, 1},
  {&__pyx_n_s_render_for_size, __pyx_k_render_for_size, sizeof(__pyx_k_render_for_size), 0, 0, 1, 1},
  {&__pyx_n_s_render_height, __pyx_k_render_height, sizeof(__pyx_k_render_height), 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_render_width, __pyx_k_render_width, sizeof(__pyx_k_render_width), 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_matrix, __pyx_k_renpy_display_matrix, sizeof(__pyx_k_renpy_display_matrix), 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_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_sizing, __pyx_k_sizing, sizeof(__pyx_k_sizing), 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_value, __pyx_k_value, sizeof(__pyx_k_value), 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_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_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 CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 1514, __pyx_L1_error)
  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 212, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "renpy/display/render.pyx":136
 * 
 *     if gc.garbage:
 *         del gc.garbage[:]             # <<<<<<<<<<<<<<
 * 
 *     l = gc.get_objects()
 */
  __pyx_slice_ = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice_)) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice_);
  __Pyx_GIVEREF(__pyx_slice_);

  /* "renpy/display/render.pyx":205
 *     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__2 = PyTuple_Pack(1, __pyx_kp_s_Displayables_may_not_be_rendered); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "renpy/display/render.pyx":276
 * 
 *     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__3 = PyTuple_Pack(2, __pyx_int_4, __pyx_kp_s_before_clipping); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 276, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "renpy/display/render.pyx":279
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)
 *         renpy.plog(4, "after clipping")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_4, __pyx_kp_s_after_clipping); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 279, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "renpy/display/render.pyx":731
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")             # <<<<<<<<<<<<<<
 *         else:
 *             return { }
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Can_t_pickle_a_Render); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 731, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "renpy/display/render.pyx":750
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         if models:
 */
  __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Blitting_to_self); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 750, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__7);
  __Pyx_GIVEREF(__pyx_tuple__7);

  /* "renpy/display/render.pyx":1042
 * 
 *         if source is self:
 *             raise Exception("Render depends on itself.")             # <<<<<<<<<<<<<<
 * 
 *         self.depends_on_list.append(source)
 */
  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Render_depends_on_itself); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 1042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__8);
  __Pyx_GIVEREF(__pyx_tuple__8);

  /* "renpy/display/render.pyx":1172
 *         if self.xclipping or self.yclipping:
 * 
 *             x1, y1 = transform.transform(0, 0)             # <<<<<<<<<<<<<<
 *             x2, y2 = transform.transform(self.width, self.height)
 * 
 */
  __pyx_tuple__9 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 1172, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "renpy/display/render.pyx":1316
 *                 # 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__10 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__10)) __PYX_ERR(0, 1316, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__10);
  __Pyx_GIVEREF(__pyx_slice__10);

  /* "renpy/display/render.pyx":1473
 *             self.forward *= Matrix2D(1.0 / xzoom, 0, 0, 1.0 / yzoom)
 *         else:
 *             self.forward *= Matrix2D(0, 0, 0, 0)             # <<<<<<<<<<<<<<
 * 
 *     def add_shader(self, shader):
 */
  __pyx_tuple__11 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 1473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "renpy/display/render.pyx":1506
 *         """
 * 
 *         if name[:3] == "gl_":             # <<<<<<<<<<<<<<
 *             name = name[3:]
 * 
 */
  __pyx_slice__12 = PySlice_New(Py_None, __pyx_int_3, Py_None); if (unlikely(!__pyx_slice__12)) __PYX_ERR(0, 1506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__12);
  __Pyx_GIVEREF(__pyx_slice__12);

  /* "renpy/display/render.pyx":1507
 * 
 *         if name[:3] == "gl_":
 *             name = name[3:]             # <<<<<<<<<<<<<<
 * 
 *         if self.properties is None:
 */
  __pyx_slice__13 = PySlice_New(__pyx_int_3, Py_None, Py_None); if (unlikely(!__pyx_slice__13)) __PYX_ERR(0, 1507, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_slice__13);
  __Pyx_GIVEREF(__pyx_slice__13);

  /* "renpy/display/render.pyx":74
 * models = False
 * 
 * def adjust_render_cache_times(old_time, new_time):             # <<<<<<<<<<<<<<
 *     """
 *     This adjusts the render cache such that if a render starts at
 */
  __pyx_tuple__14 = 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__14)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__14);
  __Pyx_GIVEREF(__pyx_tuple__14);
  __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_adjust_render_cache_times, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 74, __pyx_L1_error)

  /* "renpy/display/render.pyx":106
 * 
 * 
 * def free_memory():             # <<<<<<<<<<<<<<
 *     """
 *     Frees memory used by the render system.
 */
  __pyx_codeobj__16 = (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, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 106, __pyx_L1_error)

  /* "renpy/display/render.pyx":122
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */
  __pyx_tuple__17 = PyTuple_Pack(4, __pyx_n_s_l, __pyx_n_s_count, __pyx_n_s_objects, __pyx_n_s_i); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);
  __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_check_at_shutdown, 122, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 122, __pyx_L1_error)

  /* "renpy/display/render.pyx":162
 * render_is_ready = 0
 * 
 * def render_ready():             # <<<<<<<<<<<<<<
 *     global render_is_ready
 *     render_is_ready = 1
 */
  __pyx_codeobj__19 = (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, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 162, __pyx_L1_error)

  /* "renpy/display/render.pyx":295
 *     return rv
 * 
 * def render_for_size(d, width, height, st, at):             # <<<<<<<<<<<<<<
 *     """
 *     This returns a render of `d`  that's useful for getting the size or
 */
  __pyx_tuple__20 = PyTuple_Pack(10, __pyx_n_s_d, __pyx_n_s_width, __pyx_n_s_height, __pyx_n_s_st, __pyx_n_s_at, __pyx_n_s_id_d, __pyx_n_s_orig_wh, __pyx_n_s_render_cache_d, __pyx_n_s_rv, __pyx_n_s_old_sizing); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);
  __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_render_for_size, 295, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 295, __pyx_L1_error)

  /* "renpy/display/render.pyx":320
 * 
 * 
 * def invalidate(d):             # <<<<<<<<<<<<<<
 *     """
 *     Removes d from the render cache. If we're not in a redraw, triggers
 */
  __pyx_tuple__22 = PyTuple_Pack(2, __pyx_n_s_d, __pyx_n_s_v); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);
  __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_invalidate, 320, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 320, __pyx_L1_error)

  /* "renpy/display/render.pyx":333
 *         v.kill_cache()
 * 
 * def check_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Returns true if a redraw is required, and False otherwise.
 */
  __pyx_tuple__24 = PyTuple_Pack(4, __pyx_n_s_now, __pyx_n_s_when, __pyx_n_s_d, __pyx_n_s_id_d); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);
  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 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_check_redraws, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 333, __pyx_L1_error)

  /* "renpy/display/render.pyx":354
 *     return False
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Removes any pending redraws from the redraw queue.
 */
  __pyx_tuple__26 = 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__26)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);
  __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(0, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_process_redraws, 354, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 354, __pyx_L1_error)

  /* "renpy/display/render.pyx":401
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */
  __pyx_codeobj__28 = (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, 401, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 401, __pyx_L1_error)

  /* "renpy/display/render.pyx":412
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */
  __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_d, __pyx_n_s_when); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);
  __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_redraw, 412, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 412, __pyx_L1_error)

  /* "renpy/display/render.pyx":430
 * 
 * 
 * IDENTITY = Matrix2D(1, 0, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_tuple__31 = PyTuple_Pack(4, __pyx_int_1, __pyx_int_0, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "renpy/display/render.pyx":433
 * 
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_focuses); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 433, __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_take_focuses, 433, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 433, __pyx_L1_error)

  /* "renpy/display/render.pyx":447
 * # 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__34 = PyTuple_Pack(1, __pyx_n_s_Modal); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "renpy/display/render.pyx":449
 * Modal = renpy.object.Sentinel("Modal")
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */
  __pyx_tuple__35 = 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__35)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__35);
  __Pyx_GIVEREF(__pyx_tuple__35);
  __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_focus_at_point, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 449, __pyx_L1_error)

  /* "renpy/display/render.pyx":466
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_surf); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);
  __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_mutated_surface, 466, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 466, __pyx_L1_error)

  /* "renpy/display/render.pyx":474
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */
  __pyx_tuple__39 = 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__39)) __PYX_ERR(0, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);
  __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_render_screen, 474, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 474, __pyx_L1_error)

  /* "renpy/display/render.pyx":501
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */
  __pyx_tuple__41 = PyTuple_Pack(4, __pyx_n_s_worklist, __pyx_n_s_i, __pyx_n_s_r, __pyx_n_s_j); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__41);
  __Pyx_GIVEREF(__pyx_tuple__41);
  __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 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_mark_sweep, 501, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 501, __pyx_L1_error)

  /* "renpy/display/render.pyx":541
 *     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__43 = 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__43)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__43);
  __Pyx_GIVEREF(__pyx_tuple__43);
  __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(4, 0, 10, 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_compute_subline, 541, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 541, __pyx_L1_error)

  /* "renpy/display/render.pyx":1514
 *             self.properties[name] = value
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_tuple__45 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__45);
  __Pyx_GIVEREF(__pyx_tuple__45);

  /* "renpy/display/render.pyx":1516
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */
  __pyx_tuple__46 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_surf); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__46);
  __Pyx_GIVEREF(__pyx_tuple__46);
  __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_init, 1516, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 1516, __pyx_L1_error)

  /* "renpy/display/render.pyx":1519
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_tuple__48 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_rect, __pyx_n_s_width); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__48);
  __Pyx_GIVEREF(__pyx_tuple__48);
  __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_rect, 1519, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __pyx_tuple__50 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__50);
  __Pyx_GIVEREF(__pyx_tuple__50);

  /* "renpy/display/render.pyx":1530
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__51 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_pointlist, __pyx_n_s_width); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 1530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);
  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_polygon, 1530, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 1530, __pyx_L1_error)
  __pyx_tuple__53 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 1530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);

  /* "renpy/display/render.pyx":1540
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_tuple__54 = 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__54)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__54);
  __Pyx_GIVEREF(__pyx_tuple__54);
  __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_circle, 1540, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __pyx_tuple__56 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__56);
  __Pyx_GIVEREF(__pyx_tuple__56);

  /* "renpy/display/render.pyx":1553
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__57 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_color, __pyx_n_s_rect, __pyx_n_s_width); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_ellipse, 1553, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __pyx_tuple__59 = PyTuple_Pack(1, ((PyObject *)__pyx_int_0)); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);

  /* "renpy/display/render.pyx":1564
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__60 = 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__60)) __PYX_ERR(0, 1564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__60);
  __Pyx_GIVEREF(__pyx_tuple__60);
  __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_arc, 1564, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 1564, __pyx_L1_error)
  __pyx_tuple__62 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 1564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__62);
  __Pyx_GIVEREF(__pyx_tuple__62);

  /* "renpy/display/render.pyx":1577
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__63 = 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__63)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_line, 1577, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __pyx_tuple__65 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);

  /* "renpy/display/render.pyx":1588
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__66 = 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__66)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__66);
  __Pyx_GIVEREF(__pyx_tuple__66);
  __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_lines, 1588, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __pyx_tuple__68 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__68);
  __Pyx_GIVEREF(__pyx_tuple__68);

  /* "renpy/display/render.pyx":1599
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__69 = 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__69)) __PYX_ERR(0, 1599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_aaline, 1599, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) __PYX_ERR(0, 1599, __pyx_L1_error)
  __pyx_tuple__71 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 1599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);

  /* "renpy/display/render.pyx":1610
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_tuple__72 = 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__72)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__72);
  __Pyx_GIVEREF(__pyx_tuple__72);
  __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(5, 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_home_tom_ab_renpy_renpy_display, __pyx_n_s_aalines, 1610, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __pyx_tuple__74 = PyTuple_Pack(1, ((PyObject *)__pyx_int_1)); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__74);
  __Pyx_GIVEREF(__pyx_tuple__74);

  /* "renpy/display/render.pyx":1621
 *             blit_lock.release()
 * 
 *     def get_surface(self):             # <<<<<<<<<<<<<<
 *         return self.surf
 */
  __pyx_tuple__75 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);
  __pyx_codeobj__76 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_tom_ab_renpy_renpy_display, __pyx_n_s_get_surface, 1621, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__76)) __PYX_ERR(0, 1621, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __pyx_unpickle_Render(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_tuple__77 = 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__77)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_tuple__77);
  __Pyx_GIVEREF(__pyx_tuple__77);
  __pyx_codeobj__78 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Render, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__78)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
  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_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_147483306 = PyInt_FromLong(147483306L); if (unlikely(!__pyx_int_147483306)) __PYX_ERR(0, 1, __pyx_L1_error)
  return 0;
  __pyx_L1_error:;
  return -1;
}

static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/

static int __Pyx_modinit_global_init_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  /*--- Global init code ---*/
  __pyx_v_5renpy_7display_6render_live_renders = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_variable_export_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  /*--- Variable export code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_export_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  /*--- 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)
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_init_code(void) {
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  /*--- Type init code ---*/
  __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, 581, __pyx_L1_error)
  #if PY_VERSION_HEX < 0x030800B1
  __pyx_type_5renpy_7display_6render_Render.tp_print = 0;
  #endif
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_5renpy_7display_6render_Render.tp_dictoffset && __pyx_type_5renpy_7display_6render_Render.tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_type_5renpy_7display_6render_Render.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  }
  #if CYTHON_COMPILING_IN_CPYTHON
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_5renpy_7display_6render_Render, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 581, __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, 581, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Render, (PyObject *)&__pyx_type_5renpy_7display_6render_Render) < 0) __PYX_ERR(0, 581, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject*)&__pyx_type_5renpy_7display_6render_Render) < 0) __PYX_ERR(0, 581, __pyx_L1_error)
  __pyx_ptype_5renpy_7display_6render_Render = &__pyx_type_5renpy_7display_6render_Render;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_type_import_code(void) {
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  /*--- Type import code ---*/
  __pyx_t_1 = PyImport_ImportModule("renpy.display.matrix"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_ptype_5renpy_7display_6matrix_Matrix = __Pyx_ImportType(__pyx_t_1, "renpy.display.matrix", "Matrix", sizeof(struct __pyx_obj_5renpy_7display_6matrix_Matrix), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5renpy_7display_6matrix_Matrix) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_vtabptr_5renpy_7display_6matrix_Matrix = (struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix*)__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6matrix_Matrix->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_7display_6matrix_Matrix)) __PYX_ERR(3, 1, __pyx_L1_error)
  __pyx_ptype_5renpy_7display_6matrix_Matrix2D = __Pyx_ImportType(__pyx_t_1, "renpy.display.matrix", "Matrix2D", sizeof(struct __pyx_obj_5renpy_7display_6matrix_Matrix2D), __Pyx_ImportType_CheckSize_Warn);
   if (!__pyx_ptype_5renpy_7display_6matrix_Matrix2D) __PYX_ERR(3, 75, __pyx_L1_error)
  __pyx_vtabptr_5renpy_7display_6matrix_Matrix2D = (struct __pyx_vtabstruct_5renpy_7display_6matrix_Matrix2D*)__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6matrix_Matrix2D->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_7display_6matrix_Matrix2D)) __PYX_ERR(3, 75, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_modinit_variable_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  /*--- Variable import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_modinit_function_import_code(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __Pyx_RefNannyFinishContext();
  return 0;
}


#ifndef CYTHON_NO_PYINIT_EXPORT
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#elif PY_MAJOR_VERSION < 3
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" void
#else
#define __Pyx_PyMODINIT_FUNC void
#endif
#else
#ifdef __cplusplus
#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyObject *
#endif
#endif


#if PY_MAJOR_VERSION < 3
__Pyx_PyMODINIT_FUNC initrender(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC initrender(void)
#else
__Pyx_PyMODINIT_FUNC PyInit_render(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_render(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
    #if PY_VERSION_HEX >= 0x030700A1
    static PY_INT64_T main_interpreter_id = -1;
    PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
    if (main_interpreter_id == -1) {
        main_interpreter_id = current_id;
        return (unlikely(current_id == -1)) ? -1 : 0;
    } else if (unlikely(main_interpreter_id != current_id))
    #else
    static PyInterpreterState *main_interpreter = NULL;
    PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
    if (!main_interpreter) {
        main_interpreter = current_interpreter;
    } else if (unlikely(main_interpreter != current_interpreter))
    #endif
    {
        PyErr_SetString(
            PyExc_ImportError,
            "Interpreter change detected - this module can only be loaded into one interpreter per process.");
        return -1;
    }
    return 0;
}
static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
    PyObject *value = PyObject_GetAttrString(spec, from_name);
    int result = 0;
    if (likely(value)) {
        if (allow_none || value != Py_None) {
            result = PyDict_SetItemString(moddict, to_name, value);
        }
        Py_DECREF(value);
    } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Clear();
    } else {
        result = -1;
    }
    return result;
}
static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
    PyObject *module = NULL, *moddict, *modname;
    if (__Pyx_check_single_interpreter())
        return NULL;
    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__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
    if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
    return module;
bad:
    Py_XDECREF(module);
    return NULL;
}


static CYTHON_SMALL_CODE 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'render' has already been imported. Re-initialisation is not supported.");
    return -1;
  }
  #elif PY_MAJOR_VERSION >= 3
  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  #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("__Pyx_PyMODINIT_FUNC PyInit_render(void)", 0);
  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __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)
  Py_INCREF(__pyx_b);
  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  Py_INCREF(__pyx_cython_runtime);
  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_SetAttr(__pyx_m, __pyx_n_s_name_2, __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 type/function init code ---*/
  (void)__Pyx_modinit_global_init_code();
  (void)__Pyx_modinit_variable_export_code();
  if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  (void)__Pyx_modinit_variable_import_code();
  (void)__Pyx_modinit_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
 * 
 * from renpy.display.matrix import Matrix, Matrix2D             # <<<<<<<<<<<<<<
 * from renpy.display.matrix cimport Matrix, Matrix2D
 * 
 */
  __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_n_s_Matrix);
  __Pyx_GIVEREF(__pyx_n_s_Matrix);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Matrix);
  __Pyx_INCREF(__pyx_n_s_Matrix2D);
  __Pyx_GIVEREF(__pyx_n_s_Matrix2D);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_Matrix2D);
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_renpy_display_matrix, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __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":30
 * # This is required to get these to re-export despite having been defined
 * # in cython.
 * globals()["Matrix"] = Matrix             # <<<<<<<<<<<<<<
 * globals()["Matrix2D"] = Matrix2D
 * 
 */
  __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_s_Matrix, ((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix)) < 0)) __PYX_ERR(0, 30, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":31
 * # in cython.
 * globals()["Matrix"] = Matrix
 * globals()["Matrix2D"] = Matrix2D             # <<<<<<<<<<<<<<
 * 
 * import collections
 */
  __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_n_s_Matrix2D, ((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix2D)) < 0)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":33
 * globals()["Matrix2D"] = Matrix2D
 * 
 * import collections             # <<<<<<<<<<<<<<
 * import pygame_sdl2 as pygame
 * import threading
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_collections, __pyx_t_2) < 0) __PYX_ERR(0, 33, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":34
 * 
 * import collections
 * import pygame_sdl2 as pygame             # <<<<<<<<<<<<<<
 * import threading
 * import renpy
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_pygame_sdl2, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pygame, __pyx_t_2) < 0) __PYX_ERR(0, 34, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":35
 * import collections
 * import pygame_sdl2 as pygame
 * import threading             # <<<<<<<<<<<<<<
 * import renpy
 * import gc
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_threading, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_threading, __pyx_t_2) < 0) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":36
 * import pygame_sdl2 as pygame
 * import threading
 * import renpy             # <<<<<<<<<<<<<<
 * import gc
 * import math
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_renpy, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_renpy, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":37
 * import threading
 * import renpy
 * import gc             # <<<<<<<<<<<<<<
 * import math
 * 
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_gc, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_gc, __pyx_t_2) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":38
 * import renpy
 * import gc
 * import math             # <<<<<<<<<<<<<<
 * 
 * # We grab the blit lock each time it is necessary to blit
 */
  __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, 0, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_math, __pyx_t_2) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":43
 * # 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_threading); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Condition); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __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_blit_lock, __pyx_t_2) < 0) __PYX_ERR(0, 43, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":48
 * # 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_collections); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_defaultdict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, ((PyObject *)(&PyDict_Type))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __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_render_cache, __pyx_t_2) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":51
 * 
 * # The queue of redraws. A list of (time, displayable) pairs.
 * redraw_queue = [ ]             # <<<<<<<<<<<<<<
 * 
 * # The render returned from render_screen.
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_redraw_queue, __pyx_t_2) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":54
 * 
 * # 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, 54, __pyx_L1_error)

  /* "renpy/display/render.pyx":58
 * # 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_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XGOTREF(__pyx_v_5renpy_7display_6render_live_renders);
  __Pyx_DECREF_SET(__pyx_v_5renpy_7display_6render_live_renders, ((PyObject*)__pyx_t_2));
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":62
 * # 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":65
 * 
 * # Are we doing a per_frame update?
 * per_frame = False             # <<<<<<<<<<<<<<
 * 
 * # Are we rendering for the purpose of sizing something.
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_per_frame, Py_False) < 0) __PYX_ERR(0, 65, __pyx_L1_error)

  /* "renpy/display/render.pyx":68
 * 
 * # Are we rendering for the purpose of sizing something.
 * sizing = False             # <<<<<<<<<<<<<<
 * 
 * # This is true if we're using a renderer that supports models,
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_sizing, Py_False) < 0) __PYX_ERR(0, 68, __pyx_L1_error)

  /* "renpy/display/render.pyx":72
 * # This is true if we're using a renderer that supports models,
 * # false otherwise.
 * models = False             # <<<<<<<<<<<<<<
 * 
 * def adjust_render_cache_times(old_time, new_time):
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_models, Py_False) < 0) __PYX_ERR(0, 72, __pyx_L1_error)

  /* "renpy/display/render.pyx":74
 * models = False
 * 
 * def adjust_render_cache_times(old_time, new_time):             # <<<<<<<<<<<<<<
 *     """
 *     This adjusts the render cache such that if a render starts at
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_1adjust_render_cache_times, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_adjust_render_cache_times, __pyx_t_2) < 0) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":106
 * 
 * 
 * def free_memory():             # <<<<<<<<<<<<<<
 *     """
 *     Frees memory used by the render system.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_3free_memory, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_free_memory, __pyx_t_2) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":122
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_5check_at_shutdown, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_at_shutdown, __pyx_t_2) < 0) __PYX_ERR(0, 122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":153
 * # 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":156
 * 
 * # 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, 156, __pyx_L1_error)

  /* "renpy/display/render.pyx":157
 * # 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, 157, __pyx_L1_error)

  /* "renpy/display/render.pyx":160
 * 
 * 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":162
 * render_is_ready = 0
 * 
 * def render_ready():             # <<<<<<<<<<<<<<
 *     global render_is_ready
 *     render_is_ready = 1
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_7render_ready, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_ready, __pyx_t_2) < 0) __PYX_ERR(0, 162, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":167
 * 
 * # These are good until the next call to render.
 * render_width = 0             # <<<<<<<<<<<<<<
 * render_height = 0
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_width, __pyx_int_0) < 0) __PYX_ERR(0, 167, __pyx_L1_error)

  /* "renpy/display/render.pyx":168
 * # These are good until the next call to render.
 * render_width = 0
 * render_height = 0             # <<<<<<<<<<<<<<
 * 
 * cpdef render(d, object widtho, object heighto, double st, double at):
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_height, __pyx_int_0) < 0) __PYX_ERR(0, 168, __pyx_L1_error)

  /* "renpy/display/render.pyx":295
 *     return rv
 * 
 * def render_for_size(d, width, height, st, at):             # <<<<<<<<<<<<<<
 *     """
 *     This returns a render of `d`  that's useful for getting the size or
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_11render_for_size, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_for_size, __pyx_t_2) < 0) __PYX_ERR(0, 295, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":320
 * 
 * 
 * def invalidate(d):             # <<<<<<<<<<<<<<
 *     """
 *     Removes d from the render cache. If we're not in a redraw, triggers
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_13invalidate, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_invalidate, __pyx_t_2) < 0) __PYX_ERR(0, 320, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":333
 *         v.kill_cache()
 * 
 * def check_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Returns true if a redraw is required, and False otherwise.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_15check_redraws, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_redraws, __pyx_t_2) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":354
 *     return False
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Removes any pending redraws from the redraw queue.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_17process_redraws, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_process_redraws, __pyx_t_2) < 0) __PYX_ERR(0, 354, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":401
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_19redraw_time, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_redraw_time, __pyx_t_2) < 0) __PYX_ERR(0, 401, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":412
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_21redraw, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_redraw, __pyx_t_2) < 0) __PYX_ERR(0, 412, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":430
 * 
 * 
 * IDENTITY = Matrix2D(1, 0, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_5renpy_7display_6matrix_Matrix2D), __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IDENTITY, __pyx_t_2) < 0) __PYX_ERR(0, 430, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":433
 * 
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */
  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_23take_focuses, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_take_focuses, __pyx_t_2) < 0) __PYX_ERR(0, 433, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":447
 * # 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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_renpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __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_Sentinel); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Modal, __pyx_t_1) < 0) __PYX_ERR(0, 447, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":449
 * Modal = renpy.object.Sentinel("Modal")
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_25focus_at_point, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_focus_at_point, __pyx_t_1) < 0) __PYX_ERR(0, 449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":466
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_27mutated_surface, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutated_surface, __pyx_t_1) < 0) __PYX_ERR(0, 466, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":474
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_29render_screen, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 474, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_render_screen, __pyx_t_1) < 0) __PYX_ERR(0, 474, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":501
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_31mark_sweep, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_mark_sweep, __pyx_t_1) < 0) __PYX_ERR(0, 501, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":541
 *     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_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_33compute_subline, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_compute_subline, __pyx_t_1) < 0) __PYX_ERR(0, 541, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":575
 * 
 * # 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, 575, __pyx_L1_error)

  /* "renpy/display/render.pyx":576
 * # 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, 576, __pyx_L1_error)

  /* "renpy/display/render.pyx":577
 * BLIT = 0
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2             # <<<<<<<<<<<<<<
 * PIXELLATE = 3
 * FLATTEN = 4
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_IMAGEDISSOLVE, __pyx_int_2) < 0) __PYX_ERR(0, 577, __pyx_L1_error)

  /* "renpy/display/render.pyx":578
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2
 * PIXELLATE = 3             # <<<<<<<<<<<<<<
 * FLATTEN = 4
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_PIXELLATE, __pyx_int_3) < 0) __PYX_ERR(0, 578, __pyx_L1_error)

  /* "renpy/display/render.pyx":579
 * IMAGEDISSOLVE = 2
 * PIXELLATE = 3
 * FLATTEN = 4             # <<<<<<<<<<<<<<
 * 
 * cdef class Render:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_FLATTEN, __pyx_int_4) < 0) __PYX_ERR(0, 579, __pyx_L1_error)

  /* "renpy/display/render.pyx":882
 *         return rv
 * 
 *     pygame_surface = render_to_texture             # <<<<<<<<<<<<<<
 * 
 *     def subsurface(self, rect, focus=False):
 */
  __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_5renpy_7display_6render_Render, __pyx_n_s_render_to_texture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5renpy_7display_6render_Render->tp_dict, __pyx_n_s_pygame_surface, __pyx_t_1) < 0) __PYX_ERR(0, 882, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  PyType_Modified(__pyx_ptype_5renpy_7display_6render_Render);

  /* "renpy/display/render.pyx":1514
 *             self.properties[name] = value
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__45); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__45, __pyx_n_s_Canvas, __pyx_n_s_Canvas, (PyObject *) NULL, __pyx_n_s_renpy_display_render, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);

  /* "renpy/display/render.pyx":1516
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__47)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 1516, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1519
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__49)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__50);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_rect, __pyx_t_3) < 0) __PYX_ERR(0, 1519, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1530
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__52)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1530, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__53);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_polygon, __pyx_t_3) < 0) __PYX_ERR(0, 1530, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1540
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__55)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__56);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_circle, __pyx_t_3) < 0) __PYX_ERR(0, 1540, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1553
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__58)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__59);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_ellipse, __pyx_t_3) < 0) __PYX_ERR(0, 1553, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1564
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__61)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1564, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__62);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_arc, __pyx_t_3) < 0) __PYX_ERR(0, 1564, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1577
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__64)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__65);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_line, __pyx_t_3) < 0) __PYX_ERR(0, 1577, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1588
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__67)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__68);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_lines, __pyx_t_3) < 0) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1599
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__70)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1599, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__71);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_aaline, __pyx_t_3) < 0) __PYX_ERR(0, 1599, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1610
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__73)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__74);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_aalines, __pyx_t_3) < 0) __PYX_ERR(0, 1610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1621
 *             blit_lock.release()
 * 
 *     def get_surface(self):             # <<<<<<<<<<<<<<
 *         return self.surf
 */
  __pyx_t_3 = __Pyx_CyFunction_New(&__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__76)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_surface, __pyx_t_3) < 0) __PYX_ERR(0, 1621, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1514
 *             self.properties[name] = value
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_Canvas, __pyx_tuple__45, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_Canvas, __pyx_t_3) < 0) __PYX_ERR(0, 1514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_Render(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_35__pyx_unpickle_Render, NULL, __pyx_n_s_renpy_display_render); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Render, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1
 * #cython: profile=False             # <<<<<<<<<<<<<<
 * # Copyright 2004-2021 Tom Rothamel <pytom@bishoujo.us>
 * #
 */
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/matrix.pxd":42
 *         oz[0] = x * self.zdx + y * self.zdy + z * self.zdz + w * self.zdw
 * 
 *     cdef inline void transform2(Matrix self, float *ox, float *oy, float x, float y, float z, float w):             # <<<<<<<<<<<<<<
 *         ox[0] = x * self.xdx + y * self.xdy + z * self.xdz + w * self.xdw
 *         oy[0] = x * self.ydx + y * self.ydy + z * self.ydz + w * self.ydw
 */

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init renpy.display.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_CLEAR(__pyx_m);
  } 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(modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, "RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

/* PyObjectGetAttrStr */
#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);
}
#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_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
                    (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(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
                        (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(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
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 = __Pyx_PyFrame_GetLocalsplus(f);
    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, Py_ssize_t 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, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
#else
    result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
                               args, (int)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_CyFunction_Check(func)))
#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 | METH_STACKLESS)));
    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)(void*)meth)) (self, args, nargs, NULL);
    } else {
        return (*((__Pyx_PyCFunctionFast)(void*)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

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if PY_MAJOR_VERSION >= 3
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
        #endif
#else
        #ifdef __Pyx_CyFunction_USED
        if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
        #else
        if (likely(PyFunction_Check(descr)))
        #endif
#endif
        {
            meth_found = 1;
        } else {
            f = Py_TYPE(descr)->tp_descr_get;
            if (f != NULL && PyDescr_IsData(descr)) {
                attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
                Py_DECREF(descr);
                goto try_unpack;
            }
        }
    }
    dictptr = _PyObject_GetDictPtr(obj);
    if (dictptr != NULL && (dict = *dictptr) != NULL) {
        Py_INCREF(dict);
        attr = __Pyx_PyDict_GetItemStr(dict, name);
        if (attr != NULL) {
            Py_INCREF(attr);
            Py_DECREF(dict);
            Py_XDECREF(descr);
            goto try_unpack;
        }
        Py_DECREF(dict);
    }
    if (meth_found) {
        *method = descr;
        return 1;
    }
    if (f != NULL) {
        attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
        Py_DECREF(descr);
        goto try_unpack;
    }
    if (descr != NULL) {
        *method = descr;
        return 0;
    }
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(name));
#endif
    return 0;
#else
    attr = __Pyx_PyObject_GetAttrStr(obj, name);
    goto try_unpack;
#endif
try_unpack:
#if CYTHON_UNPACK_METHODS
    if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
        PyObject *function = PyMethod_GET_FUNCTION(attr);
        Py_INCREF(function);
        Py_DECREF(attr);
        *method = function;
        return 1;
    }
#endif
    *method = attr;
    return 0;
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    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;
}

/* PyDictVersioning */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
    PyObject **dictptr = NULL;
    Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
    if (offset) {
#if CYTHON_COMPILING_IN_CPYTHON
        dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
#else
        dictptr = _PyObject_GetDictPtr(obj);
#endif
    }
    return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
}
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
    PyObject *dict = Py_TYPE(obj)->tp_dict;
    if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
        return 0;
    return obj_dict_version == __Pyx_get_object_dict_version(obj);
}
#endif

/* GetModuleGlobalName */
#if CYTHON_USE_DICT_VERSIONS
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
#else
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
#endif
{
    PyObject *result;
#if !CYTHON_AVOID_BORROWED_REFS
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
    result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    } else if (unlikely(PyErr_Occurred())) {
        return NULL;
    }
#else
    result = PyDict_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
#endif
#else
    result = PyObject_GetItem(__pyx_d, name);
    __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
    if (likely(result)) {
        return __Pyx_NewRef(result);
    }
    PyErr_Clear();
#endif
    return __Pyx_GetBuiltinName(name);
}

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

/* PyObjectSetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
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);
}
#endif

/* 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_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
    PyObject *runerr;
    Py_ssize_t key_value;
    PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
    if (unlikely(!(m && m->sq_item))) {
        PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
        return NULL;
    }
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        PyErr_Clear();
        PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
    }
    return NULL;
}
static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
    PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
    if (likely(m && m->mp_subscript)) {
        return m->mp_subscript(obj, key);
    }
    return __Pyx_PyObject_GetIndex(obj, key);
}
#endif

/* UnpackUnboundCMethod */
static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
    PyObject *method;
    method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
    if (unlikely(!method))
        return -1;
    target->method = method;
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION >= 3
    if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
    #endif
    {
        PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
        target->func = descr->d_method->ml_meth;
        target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
    }
#endif
    return 0;
}

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    if (likely(cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return (*(cfunc->func))(self, arg);
        } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
            if (PY_VERSION_HEX >= 0x030700A0) {
                return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
            } else {
                return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
            }
        } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
        }
    }
    return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 1, arg);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(2, self, arg);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* CallUnboundCMethod2 */
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
    if (likely(cfunc->func)) {
        PyObject *args[2] = {arg1, arg2};
        if (cfunc->flag == METH_FASTCALL) {
            #if PY_VERSION_HEX >= 0x030700A0
            return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
            #else
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
            #endif
        }
        #if PY_VERSION_HEX >= 0x030700A0
        if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
            return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
        #endif
    }
    return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
}
#endif
static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
    PyObject *args, *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        args = PyTuple_New(2);
        if (unlikely(!args)) goto bad;
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 0, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 1, arg2);
        if (cfunc->flag & METH_KEYWORDS)
            result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
        else
            result = (*cfunc->func)(self, args);
    } else {
        args = PyTuple_New(3);
        if (unlikely(!args)) goto bad;
        Py_INCREF(self);
        PyTuple_SET_ITEM(args, 0, self);
        Py_INCREF(arg1);
        PyTuple_SET_ITEM(args, 1, arg1);
        Py_INCREF(arg2);
        PyTuple_SET_ITEM(args, 2, arg2);
        result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
    }
#else
    args = PyTuple_Pack(3, self, arg1, arg2);
    if (unlikely(!args)) goto bad;
    result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
#endif
bad:
    Py_XDECREF(args);
    return result;
}

/* 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);
    if ((1));
#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);
    }
#endif
    else {
        if (default_value == Py_None)
            value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
        else
            value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
    }
    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 CYTHON_USE_EXC_INFO_STACK
    {
        _PyErr_StackItem *exc_info = tstate->exc_info;
        tmp_type = exc_info->exc_type;
        tmp_value = exc_info->exc_value;
        tmp_tb = exc_info->exc_traceback;
        exc_info->exc_type = local_type;
        exc_info->exc_value = local_value;
        exc_info->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 CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = *type;
    exc_info->exc_value = *value;
    exc_info->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);
}

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->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 CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->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

/* PyObjectCall2Args */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args, *result = NULL;
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyFunction_FastCall(function, args, 2);
    }
    #endif
    #if CYTHON_FAST_PYCCALL
    if (__Pyx_PyFastCFunction_Check(function)) {
        PyObject *args[2] = {arg1, arg2};
        return __Pyx_PyCFunction_FastCall(function, args, 2);
    }
    #endif
    args = PyTuple_New(2);
    if (unlikely(!args)) goto done;
    Py_INCREF(arg1);
    PyTuple_SET_ITEM(args, 0, arg1);
    Py_INCREF(arg2);
    PyTuple_SET_ITEM(args, 1, arg2);
    Py_INCREF(function);
    result = __Pyx_PyObject_Call(function, args, NULL);
    Py_DECREF(args);
    Py_DECREF(function);
done:
    return result;
}

/* PyObjectCallMethod1 */
static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
    PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
    Py_DECREF(method);
    return result;
}
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
}

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

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

/* CythonFunctionShared */
#include <structmember.h>
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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
{
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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, CYTHON_UNUSED void *context) {
    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_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
                                       PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    if (unlikely(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_size = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    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)(void*)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
#if PY_VERSION_HEX >= 0x030800b1
    0,
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
    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;
    m->defaults_size = size;
    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);
}

/* CythonFunction */
static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    PyObject *op = __Pyx_CyFunction_Init(
        PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
        ml, flags, qualname, closure, module, globals, code
    );
    if (likely(op)) {
        PyObject_GC_Track(op);
    }
    return op;
}

/* pyfrozenset_new */
static CYTHON_INLINE PyObject* __Pyx_PyFrozenSet_New(PyObject* it) {
    if (it) {
        PyObject* result;
#if CYTHON_COMPILING_IN_PYPY
        PyObject* args;
        args = PyTuple_Pack(1, it);
        if (unlikely(!args))
            return NULL;
        result = PyObject_Call((PyObject*)&PyFrozenSet_Type, args, NULL);
        Py_DECREF(args);
        return result;
#else
        if (PyFrozenSet_CheckExact(it)) {
            Py_INCREF(it);
            return it;
        }
        result = PyFrozenSet_New(it);
        if (unlikely(!result))
            return NULL;
        if (likely(PySet_GET_SIZE(result)))
            return result;
        Py_DECREF(result);
#endif
    }
#if CYTHON_USE_TYPE_SLOTS
    return PyFrozenSet_Type.tp_new(&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#else
    return PyObject_Call((PyObject*)&PyFrozenSet_Type, __pyx_empty_tuple, NULL);
#endif
}

/* PySetContains */
static int __Pyx_PySet_ContainsUnhashable(PyObject *set, PyObject *key) {
    int result = -1;
    if (PySet_Check(key) && PyErr_ExceptionMatches(PyExc_TypeError)) {
        PyObject *tmpkey;
        PyErr_Clear();
        tmpkey = __Pyx_PyFrozenSet_New(key);
        if (tmpkey != NULL) {
            result = PySet_Contains(set, tmpkey);
            Py_DECREF(tmpkey);
        }
    }
    return result;
}
static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, int eq) {
    int result = PySet_Contains(set, key);
    if (unlikely(result < 0)) {
        result = __Pyx_PySet_ContainsUnhashable(set, key);
    }
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

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

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

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

/* set_iter */
static CYTHON_INLINE PyObject* __Pyx_set_iterator(PyObject* iterable, int is_set,
                                                  Py_ssize_t* p_orig_length, int* p_source_is_set) {
#if CYTHON_COMPILING_IN_CPYTHON
    is_set = is_set || likely(PySet_CheckExact(iterable) || PyFrozenSet_CheckExact(iterable));
    *p_source_is_set = is_set;
    if (likely(is_set)) {
        *p_orig_length = PySet_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
    }
#else
    (void)is_set;
    *p_source_is_set = 0;
#endif
    *p_orig_length = 0;
    return PyObject_GetIter(iterable);
}
static CYTHON_INLINE int __Pyx_set_iter_next(
        PyObject* iter_obj, Py_ssize_t orig_length,
        Py_ssize_t* ppos, PyObject **value,
        int source_is_set) {
    if (!CYTHON_COMPILING_IN_CPYTHON || unlikely(!source_is_set)) {
        *value = PyIter_Next(iter_obj);
        if (unlikely(!*value)) {
            return __Pyx_IterFinish();
        }
        (void)orig_length;
        (void)ppos;
        return 1;
    }
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(PySet_GET_SIZE(iter_obj) != orig_length)) {
        PyErr_SetString(
            PyExc_RuntimeError,
            "set changed size during iteration");
        return -1;
    }
    {
        Py_hash_t hash;
        int ret = _PySet_NextEntry(iter_obj, ppos, value, &hash);
        assert (ret != -1);
        if (likely(ret)) {
            Py_INCREF(*value);
            return 1;
        }
    }
#endif
    return 0;
}

/* PyIntBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
    (void)inplace;
    (void)zerodivision_check;
    #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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
                    }
                    CYTHON_FALLTHROUGH;
                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
#define __Pyx_PyFloat_DivideCObj_ZeroDivisionError(operand) if (unlikely(zerodivision_check && ((operand) == 0))) {\
    PyErr_SetString(PyExc_ZeroDivisionError, "float division by zero");\
    return NULL;\
}
static PyObject* __Pyx_PyFloat_DivideCObj(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) {
    const double a = floatval;
    double b, result;
    (void)inplace;
    (void)zerodivision_check;
    if (likely(PyFloat_CheckExact(op2))) {
        b = PyFloat_AS_DOUBLE(op2);
        __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
    } else
    #if PY_MAJOR_VERSION < 3
    if (likely(PyInt_CheckExact(op2))) {
        b = (double) PyInt_AS_LONG(op2);
        __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
    } 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: __Pyx_PyFloat_DivideCObj_ZeroDivisionError(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;
                    }
                }
                CYTHON_FALLTHROUGH;
            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;
                    }
                }
                CYTHON_FALLTHROUGH;
            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;
                    }
                }
                CYTHON_FALLTHROUGH;
            default:
        #else
        {
        #endif
            b = PyLong_AsDouble(op2);
            if (unlikely(b == -1.0 && PyErr_Occurred())) return NULL;
            __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
        }
    } else {
        return (inplace ? __Pyx_PyNumber_InPlaceDivide(op1, op2) : __Pyx_PyNumber_Divide(op1, op2));
    }
        __Pyx_PyFloat_DivideCObj_ZeroDivisionError(b)
        PyFPE_START_PROTECT("divide", return NULL)
        result = a / b;
        PyFPE_END_PROTECT(result)
        return PyFloat_FromDouble(result);
}
#endif

/* BytesEquals */
  static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result;
#if CYTHON_USE_UNICODE_INTERNALS
            Py_hash_t hash1, hash2;
            hash1 = ((PyBytesObject*)s1)->ob_shash;
            hash2 = ((PyBytesObject*)s2)->ob_shash;
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                return (equals == Py_NE);
            }
#endif
            result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

/* UnicodeEquals */
  static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
#if PY_MAJOR_VERSION < 3
    PyObject* owned_ref = NULL;
#endif
    int s1_is_unicode, s2_is_unicode;
    if (s1 == s2) {
        goto return_eq;
    }
    s1_is_unicode = PyUnicode_CheckExact(s1);
    s2_is_unicode = PyUnicode_CheckExact(s2);
#if PY_MAJOR_VERSION < 3
    if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
        owned_ref = PyUnicode_FromObject(s2);
        if (unlikely(!owned_ref))
            return -1;
        s2 = owned_ref;
        s2_is_unicode = 1;
    } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
        owned_ref = PyUnicode_FromObject(s1);
        if (unlikely(!owned_ref))
            return -1;
        s1 = owned_ref;
        s1_is_unicode = 1;
    } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
        return __Pyx_PyBytes_Equals(s1, s2, equals);
    }
#endif
    if (s1_is_unicode & s2_is_unicode) {
        Py_ssize_t length;
        int kind;
        void *data1, *data2;
        if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            return -1;
        length = __Pyx_PyUnicode_GET_LENGTH(s1);
        if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
            goto return_ne;
        }
#if CYTHON_USE_UNICODE_INTERNALS
        {
            Py_hash_t hash1, hash2;
        #if CYTHON_PEP393_ENABLED
            hash1 = ((PyASCIIObject*)s1)->hash;
            hash2 = ((PyASCIIObject*)s2)->hash;
        #else
            hash1 = ((PyUnicodeObject*)s1)->hash;
            hash2 = ((PyUnicodeObject*)s2)->hash;
        #endif
            if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
                goto return_ne;
            }
        }
#endif
        kind = __Pyx_PyUnicode_KIND(s1);
        if (kind != __Pyx_PyUnicode_KIND(s2)) {
            goto return_ne;
        }
        data1 = __Pyx_PyUnicode_DATA(s1);
        data2 = __Pyx_PyUnicode_DATA(s2);
        if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
            goto return_ne;
        } else if (length == 1) {
            goto return_eq;
        } else {
            int result = memcmp(data1, data2, (size_t)(length * kind));
            #if PY_MAJOR_VERSION < 3
            Py_XDECREF(owned_ref);
            #endif
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & s2_is_unicode) {
        goto return_ne;
    } else if ((s2 == Py_None) & s1_is_unicode) {
        goto return_ne;
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        #if PY_MAJOR_VERSION < 3
        Py_XDECREF(owned_ref);
        #endif
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
return_eq:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_EQ);
return_ne:
    #if PY_MAJOR_VERSION < 3
    Py_XDECREF(owned_ref);
    #endif
    return (equals == Py_NE);
#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);
}

/* 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 ((1) && (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, (PyObject *)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;
    }
}

/* PyObject_GenericGetAttrNoDict */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
    PyErr_Format(PyExc_AttributeError,
#if PY_MAJOR_VERSION >= 3
                 "'%.50s' object has no attribute '%U'",
                 tp->tp_name, attr_name);
#else
                 "'%.50s' object has no attribute '%.400s'",
                 tp->tp_name, PyString_AS_STRING(attr_name));
#endif
    return NULL;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
    PyObject *descr;
    PyTypeObject *tp = Py_TYPE(obj);
    if (unlikely(!PyString_Check(attr_name))) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    assert(!tp->tp_dictoffset);
    descr = _PyType_Lookup(tp, attr_name);
    if (unlikely(!descr)) {
        return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
    }
    Py_INCREF(descr);
    #if PY_MAJOR_VERSION < 3
    if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
    #endif
    {
        descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
        if (unlikely(f)) {
            PyObject *res = f(descr, obj, (PyObject *)tp);
            Py_DECREF(descr);
            return res;
        }
    }
    return descr;
}
#endif

/* PyObject_GenericGetAttr */
  #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
    if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
        return PyObject_GenericGetAttr(obj, attr_name);
    }
    return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
}
#endif

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

/* PyObjectGetAttrStrNoError */
  static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        __Pyx_PyErr_Clear();
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
        return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
    }
#endif
    result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
    if (unlikely(!result)) {
        __Pyx_PyObject_GetAttrStr_ClearAttributeError();
    }
    return result;
}

/* 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_2);
  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 __PYX_GOOD;
#else
    if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
#endif
#if CYTHON_USE_PYTYPE_LOOKUP
    object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#else
    object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
#endif
    reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_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 __PYX_BAD;
#else
        object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
#endif
        reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
        if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
            reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
            if (likely(reduce_cython)) {
                ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
            } else if (reduce == object_reduce || PyErr_Occurred()) {
                goto __PYX_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_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
                if (likely(setstate_cython)) {
                    ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                    ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
                } else if (!setstate || PyErr_Occurred()) {
                    goto __PYX_BAD;
                }
            }
            PyType_Modified((PyTypeObject*)type_obj);
        }
    }
    goto __PYX_GOOD;
__PYX_BAD:
    if (!PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
    ret = -1;
__PYX_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;
}

/* TypeImport */
  #ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
    size_t size, enum __Pyx_ImportType_CheckSize check_size)
{
    PyObject *result = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if ((size_t)basicsize < size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%.200s.%.200s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        goto bad;
    }
    else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility. "
            "Expected %zd from C header, got %zd from PyObject",
            module_name, class_name, size, basicsize);
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(result);
    return NULL;
}
#endif

/* GetVTable */
  static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

/* Globals */
  static PyObject* __Pyx_Globals(void) {
    Py_ssize_t i;
    PyObject *names;
    PyObject *globals = __pyx_d;
    Py_INCREF(globals);
    names = PyObject_Dir(__pyx_m);
    if (!names)
        goto bad;
    for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject* name = PySequence_ITEM(names, i);
        if (!name)
            goto bad;
#else
        PyObject* name = PyList_GET_ITEM(names, i);
#endif
        if (!PyDict_Contains(globals, name)) {
            PyObject* value = __Pyx_GetAttr(__pyx_m, name);
            if (!value) {
#if CYTHON_COMPILING_IN_PYPY
                Py_DECREF(name);
#endif
                goto bad;
            }
            if (PyDict_SetItem(globals, name, value) < 0) {
#if CYTHON_COMPILING_IN_PYPY
                Py_DECREF(name);
#endif
                Py_DECREF(value);
                goto bad;
            }
        }
#if CYTHON_COMPILING_IN_PYPY
        Py_DECREF(name);
#endif
    }
    Py_DECREF(names);
    return globals;
bad:
    Py_XDECREF(names);
    Py_XDECREF(globals);
    return NULL;
}

/* GetNameInClass */
  static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
    PyObject *result;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
        return NULL;
    __Pyx_PyErr_Clear();
    __Pyx_GetModuleGlobalNameUncached(result, name);
    return result;
}
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;
}

/* 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_NCP_UNUSED PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    if (unlikely(!__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*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 (use_cline == Py_False || (use_cline != Py_True && 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) ((int) 0 - (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) ((long) 0 - (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) ((int) 0 - (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) ((long) 0 - (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 int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
    Py_ssize_t i, n;
    assert(PyExceptionClass_Check(exc_type));
    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++) {
        PyObject *t = PyTuple_GET_ITEM(tuple, i);
        #if PY_MAJOR_VERSION < 3
        if (likely(exc_type == t)) return 1;
        #endif
        if (likely(PyExceptionClass_Check(t))) {
            if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
        } else {
        }
    }
    return 0;
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
    if (likely(err == exc_type)) return 1;
    if (likely(PyExceptionClass_Check(err))) {
        if (likely(PyExceptionClass_Check(exc_type))) {
            return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
        } else if (likely(PyTuple_Check(exc_type))) {
            return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
        } else {
        }
    }
    return PyErr_GivenExceptionMatches(err, exc_type);
}
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
    assert(PyExceptionClass_Check(exc_type1));
    assert(PyExceptionClass_Check(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)
            return -1;
        ++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 CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
    int retval;
    if (unlikely(!x)) return -1;
    retval = __Pyx_PyObject_IsTrue(x);
    Py_DECREF(x);
    return retval;
}
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(b);
  }
#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_PyBool_FromLong(long b) {
  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
