/* Generated by Cython 0.15.1 on Mon Feb 27 23:39:08 2012 */

#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.
#else

#include <stddef.h> /* For offsetof */
#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

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#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
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_VERSION_HEX < 0x03020000
  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_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__renpy__display__render
#define __PYX_HAVE_API__renpy__display__render
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if 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

/* unused attribute */
#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)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

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


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
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",
};

/*--- Type declarations ---*/
struct __pyx_obj_5renpy_7display_6render_Render;
struct __pyx_obj_5renpy_7display_6render_Matrix2D;
struct __pyx_opt_args_5renpy_7display_6render_6Render_blit;
struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit;

/* "renpy/display/render.pxd":42
 *     cdef public bint modal
 * 
 *     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=*)
 * 
 */
struct __pyx_opt_args_5renpy_7display_6render_6Render_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

/* "renpy/display/render.pxd":43
 * 
 *     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=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */
struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

/* "renpy/display/render.pxd":9
 *     cpdef tuple transform(Matrix2D self, double x, double y)
 * 
 * cdef class Render:             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint mark, cache_killed
 */
struct __pyx_obj_5renpy_7display_6render_Render {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6render_Render *__pyx_vtab;
  int mark;
  int cache_killed;
  float width;
  float height;
  PyObject *layer_name;
  PyObject *children;
  PyObject *parents;
  PyObject *depends_on_list;
  int operation;
  double operation_complete;
  int operation_alpha;
  PyObject *operation_parameter;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *forward;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *reverse;
  double alpha;
  PyObject *focuses;
  PyObject *pass_focuses;
  PyObject *draw_func;
  PyObject *render_of;
  int opaque;
  PyObject *visible_children;
  int clipping;
  PyObject *surface;
  PyObject *alpha_surface;
  PyObject *half_cache;
  int modal;
};


/* "renpy/display/render.pxd":1
 * cdef class Matrix2D:             # <<<<<<<<<<<<<<
 *     cdef public double xdx
 *     cdef public double xdy
 */
struct __pyx_obj_5renpy_7display_6render_Matrix2D {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *__pyx_vtab;
  double xdx;
  double xdy;
  double ydx;
  double ydy;
};



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

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


/* "renpy/display/render.pyx":452
 * PIXELLATE = 3
 * 
 * cdef class Render:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(Render self, float width, float height, draw_func=None, layer_name=None, bint opaque=None): #@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);
};
static struct __pyx_vtabstruct_5renpy_7display_6render_Render *__pyx_vtabptr_5renpy_7display_6render_Render;

#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); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #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)
  #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 /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
    PyObject* value;
#if PY_MAJOR_VERSION >= 3
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (unlikely(PyErr_Occurred()))
            return NULL;
        value = default_value;
    }
    Py_INCREF(value);
#else
    if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
        /* these presumably have safe hash functions */
        value = PyDict_GetItem(d, key);
        if (unlikely(!value)) {
            value = default_value;
        }
        Py_INCREF(value);
    } else {
        PyObject *m;
        m = __Pyx_GetAttrString(d, "get");
        if (!m) return NULL;
        value = PyObject_CallFunctionObjArgs(m, key,
            (default_value == Py_None) ? NULL : default_value, NULL);
        Py_DECREF(m);
    }
#endif
    return value;
}

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

static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (PyList_Append(L, x) < 0) return NULL;
        Py_INCREF(Py_None);
        return Py_None; /* this is just to have an accurate signature */
    }
    else {
        PyObject *r, *m;
        m = __Pyx_GetAttrString(L, "append");
        if (!m) return NULL;
        r = PyObject_CallFunctionObjArgs(m, x, NULL);
        Py_DECREF(m);
        return r;
    }
}

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

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

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

static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
    return unlikely(b < 0) ? b : !b; 
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

#if PY_VERSION_HEX < 0x02050000
#ifndef PyAnySet_CheckExact

#define PyAnySet_CheckExact(ob) \
    ((ob)->ob_type == &PySet_Type || \
     (ob)->ob_type == &PyFrozenSet_Type)

#define PySet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL)

#define Pyx_PyFrozenSet_New(iterable) \
    PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL)

#define PySet_Size(anyset) \
    PyObject_Size((anyset))

#define PySet_Contains(anyset, key) \
    PySequence_Contains((anyset), (key))

#define PySet_Pop(set) \
    PyObject_CallMethod(set, (char *)"pop", NULL)

static CYTHON_INLINE int PySet_Clear(PyObject *set) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) {
    PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key);
    if (!ret) return -1;
    Py_DECREF(ret); return 0;
}

#endif /* PyAnySet_CheckExact (<= Py2.4) */

#if PY_VERSION_HEX < 0x02040000
#ifndef Py_SETOBJECT_H
#define Py_SETOBJECT_H

static PyTypeObject *__Pyx_PySet_Type = NULL;
static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL;

#define PySet_Type (*__Pyx_PySet_Type)
#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type)

#define PyAnySet_Check(ob) \
    (PyAnySet_CheckExact(ob) || \
     PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \
     PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type))

#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type)

static int __Pyx_Py23SetsImport(void) {
    PyObject *sets=0, *Set=0, *ImmutableSet=0;

    sets = PyImport_ImportModule((char *)"sets");
    if (!sets) goto bad;
    Set = PyObject_GetAttrString(sets, (char *)"Set");
    if (!Set) goto bad;
    ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet");
    if (!ImmutableSet) goto bad;
    Py_DECREF(sets);

    __Pyx_PySet_Type       = (PyTypeObject*) Set;
    __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet;

    return 0;

 bad:
    Py_XDECREF(sets);
    Py_XDECREF(Set);
    Py_XDECREF(ImmutableSet);
    return -1;
}

#else
static int __Pyx_Py23SetsImport(void) { return 0; }
#endif /* !Py_SETOBJECT_H */
#endif /* < Py2.4  */
#endif /* < Py2.5  */

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

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


static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}


#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_List_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
            PyObject *r = PyList_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Tuple_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
    if (likely(o != Py_None)) {
        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, i);
            Py_INCREF(r);
            return r;
        }
        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
            Py_INCREF(r);
            return r;
        }
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}


#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
                                                    __Pyx_GetItemInt_Fast(o, i) : \
                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
    PyObject *r;
    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
    }
    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
        r = PySequence_GetItem(o, i);
    }
    else {
        r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
    }
    return r;
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

static double __Pyx__PyObject_AsDouble(PyObject* obj); /* proto */

#define __Pyx_PyObject_AsDouble(obj) \
    ((likely(PyFloat_CheckExact(obj))) ? \
     PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname); /*proto*/

#define __pyx_binding_PyCFunctionType_USED 1

typedef struct {
    PyCFunctionObject func;
} __pyx_binding_PyCFunctionType_object;

static PyTypeObject __pyx_binding_PyCFunctionType_type;
static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;

static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module); /* proto */
#define __pyx_binding_PyCFunctionType_New(ml, self) __pyx_binding_PyCFunctionType_NewEx(ml, self, NULL)

static int __pyx_binding_PyCFunctionType_init(void); /* proto */

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

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

static int __Pyx_check_binary_version(void);

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

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

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

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

/* Module declarations from 'renpy.display.render' */
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Matrix2D = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Render = 0;
static PyObject *__pyx_v_5renpy_7display_6render_live_renders = 0;
static double __pyx_v_5renpy_7display_6render_frame_time;
static PyObject *__pyx_f_5renpy_7display_6render_render(PyObject *, PyObject *, PyObject *, double, double, int __pyx_skip_dispatch); /*proto*/
#define __Pyx_MODULE_NAME "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_Exception;
static PyObject *__pyx_builtin_id;
static char __pyx_k_1[] = "%d Renders are alive at shutdown. This is probably a memory leak bug in Ren'Py.";
static char __pyx_k_2[] = "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)";
static char __pyx_k_4[] = "<Render %x of %r>";
static char __pyx_k_5[] = "Can't pickle a Render.";
static char __pyx_k_9[] = "Blitting to self.";
static char __pyx_k_16[] = "Render depends on itself.";
static char __pyx_k_18[] = "main_displayables_at_point";
static char __pyx_k_21[] = "renpy.display.render";
static char __pyx_k__d[] = "d";
static char __pyx_k__h[] = "h";
static char __pyx_k__w[] = "w";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__at[] = "at";
static char __pyx_k__cw[] = "cw";
static char __pyx_k__gc[] = "gc";
static char __pyx_k__id[] = "id";
static char __pyx_k__mx[] = "mx";
static char __pyx_k__my[] = "my";
static char __pyx_k__st[] = "st";
static char __pyx_k__sw[] = "sw";
static char __pyx_k__add[] = "add";
static char __pyx_k__arc[] = "arc";
static char __pyx_k__arg[] = "arg";
static char __pyx_k__cx0[] = "cx0";
static char __pyx_k__pos[] = "pos";
static char __pyx_k__sx0[] = "sx0";
static char __pyx_k__xdx[] = "xdx";
static char __pyx_k__xdy[] = "xdy";
static char __pyx_k__ydx[] = "ydx";
static char __pyx_k__ydy[] = "ydy";
static char __pyx_k__BLIT[] = "BLIT";
static char __pyx_k__blit[] = "blit";
static char __pyx_k__core[] = "core";
static char __pyx_k__draw[] = "draw";
static char __pyx_k__easy[] = "easy";
static char __pyx_k__game[] = "game";
static char __pyx_k__line[] = "line";
static char __pyx_k__main[] = "main";
static char __pyx_k__mask[] = "mask";
static char __pyx_k__rect[] = "rect";
static char __pyx_k__root[] = "root";
static char __pyx_k__self[] = "self";
static char __pyx_k__sort[] = "sort";
static char __pyx_k__surf[] = "surf";
static char __pyx_k__when[] = "when";
static char __pyx_k__Focus[] = "Focus";
static char __pyx_k__Modal[] = "Modal";
static char __pyx_k__Solid[] = "Solid";
static char __pyx_k__alpha[] = "alpha";
static char __pyx_k__blend[] = "blend";
static char __pyx_k__clear[] = "clear";
static char __pyx_k__cmaxx[] = "cmaxx";
static char __pyx_k__cmaxy[] = "cmaxy";
static char __pyx_k__cminx[] = "cminx";
static char __pyx_k__cminy[] = "cminy";
static char __pyx_k__color[] = "color";
static char __pyx_k__depth[] = "depth";
static char __pyx_k__focus[] = "focus";
static char __pyx_k__index[] = "index";
static char __pyx_k__items[] = "items";
static char __pyx_k__lines[] = "lines";
static char __pyx_k__renpy[] = "renpy";
static char __pyx_k__style[] = "style";
static char __pyx_k__width[] = "width";
static char __pyx_k__Canvas[] = "Canvas";
static char __pyx_k__aaline[] = "aaline";
static char __pyx_k__circle[] = "circle";
static char __pyx_k__closed[] = "closed";
static char __pyx_k__config[] = "config";
static char __pyx_k__endpos[] = "endpos";
static char __pyx_k__extend[] = "extend";
static char __pyx_k__height[] = "height";
static char __pyx_k__layers[] = "layers";
static char __pyx_k__object[] = "object";
static char __pyx_k__opaque[] = "opaque";
static char __pyx_k__pygame[] = "pygame";
static char __pyx_k__radius[] = "radius";
static char __pyx_k__redraw[] = "redraw";
static char __pyx_k__render[] = "render";
static char __pyx_k__source[] = "source";
static char __pyx_k__values[] = "values";
static char __pyx_k__widtho[] = "widtho";
static char __pyx_k__aalines[] = "aalines";
static char __pyx_k__acquire[] = "acquire";
static char __pyx_k__collect[] = "collect";
static char __pyx_k__discard[] = "discard";
static char __pyx_k__display[] = "display";
static char __pyx_k__ellipse[] = "ellipse";
static char __pyx_k__end_pos[] = "end_pos";
static char __pyx_k__focuses[] = "focuses";
static char __pyx_k__heighto[] = "heighto";
static char __pyx_k__parents[] = "parents";
static char __pyx_k__polygon[] = "polygon";
static char __pyx_k__release[] = "release";
static char __pyx_k__reverse[] = "reverse";
static char __pyx_k__surface[] = "surface";
static char __pyx_k__DISSOLVE[] = "DISSOLVE";
static char __pyx_k__IDENTITY[] = "IDENTITY";
static char __pyx_k____init__[] = "__init__";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__clipping[] = "clipping";
static char __pyx_k__get_size[] = "get_size";
static char __pyx_k__get_time[] = "get_time";
static char __pyx_k__pgrender[] = "pgrender";
static char __pyx_k__startpos[] = "startpos";
static char __pyx_k__surftree[] = "surftree";
static char __pyx_k__xmaximum[] = "xmaximum";
static char __pyx_k__ymaximum[] = "ymaximum";
static char __pyx_k__Condition[] = "Condition";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__PIXELLATE[] = "PIXELLATE";
static char __pyx_k__add_focus[] = "add_focus";
static char __pyx_k__blit_lock[] = "blit_lock";
static char __pyx_k__developer[] = "developer";
static char __pyx_k__draw_func[] = "draw_func";
static char __pyx_k__imagelike[] = "imagelike";
static char __pyx_k__interface[] = "interface";
static char __pyx_k__is_opaque[] = "is_opaque";
static char __pyx_k__pointlist[] = "pointlist";
static char __pyx_k__render_of[] = "render_of";
static char __pyx_k__start_pos[] = "start_pos";
static char __pyx_k__threading[] = "threading";
static char __pyx_k__transform[] = "transform";
static char __pyx_k__depends_on[] = "depends_on";
static char __pyx_k__frame_time[] = "frame_time";
static char __pyx_k__invalidate[] = "invalidate";
static char __pyx_k__kill_cache[] = "kill_cache";
static char __pyx_k__layer_name[] = "layer_name";
static char __pyx_k__mark_sweep[] = "mark_sweep";
static char __pyx_k__stop_angle[] = "stop_angle";
static char __pyx_k__subsurface[] = "subsurface";
static char __pyx_k__collections[] = "collections";
static char __pyx_k__defaultdict[] = "defaultdict";
static char __pyx_k__free_memory[] = "free_memory";
static char __pyx_k__get_objects[] = "get_objects";
static char __pyx_k__invalidated[] = "invalidated";
static char __pyx_k__redraw_time[] = "redraw_time";
static char __pyx_k__start_angle[] = "start_angle";
static char __pyx_k__cache_killed[] = "cache_killed";
static char __pyx_k__redraw_queue[] = "redraw_queue";
static char __pyx_k__render_cache[] = "render_cache";
static char __pyx_k__take_focuses[] = "take_focuses";
static char __pyx_k__IMAGEDISSOLVE[] = "IMAGEDISSOLVE";
static char __pyx_k__render_screen[] = "render_screen";
static char __pyx_k__screen_render[] = "screen_render";
static char __pyx_k__subpixel_blit[] = "subpixel_blit";
static char __pyx_k__focus_at_point[] = "focus_at_point";
static char __pyx_k__pygame_surface[] = "pygame_surface";
static char __pyx_k__compute_subline[] = "compute_subline";
static char __pyx_k__is_pixel_opaque[] = "is_pixel_opaque";
static char __pyx_k__mutated_surface[] = "mutated_surface";
static char __pyx_k__process_redraws[] = "process_redraws";
static char __pyx_k__check_at_shutdown[] = "check_at_shutdown";
static char __pyx_k__render_to_texture[] = "render_to_texture";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_n_s_18;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_n_s_21;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_n_s__BLIT;
static PyObject *__pyx_n_s__Canvas;
static PyObject *__pyx_n_s__Condition;
static PyObject *__pyx_n_s__DISSOLVE;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__Focus;
static PyObject *__pyx_n_s__IDENTITY;
static PyObject *__pyx_n_s__IMAGEDISSOLVE;
static PyObject *__pyx_n_s__Modal;
static PyObject *__pyx_n_s__PIXELLATE;
static PyObject *__pyx_n_s__Solid;
static PyObject *__pyx_n_s____init__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__aaline;
static PyObject *__pyx_n_s__aalines;
static PyObject *__pyx_n_s__acquire;
static PyObject *__pyx_n_s__add;
static PyObject *__pyx_n_s__add_focus;
static PyObject *__pyx_n_s__alpha;
static PyObject *__pyx_n_s__arc;
static PyObject *__pyx_n_s__arg;
static PyObject *__pyx_n_s__at;
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__check_at_shutdown;
static PyObject *__pyx_n_s__circle;
static PyObject *__pyx_n_s__clear;
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__cw;
static PyObject *__pyx_n_s__cx0;
static PyObject *__pyx_n_s__d;
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__discard;
static PyObject *__pyx_n_s__display;
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_n_s__endpos;
static PyObject *__pyx_n_s__extend;
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__frame_time;
static PyObject *__pyx_n_s__free_memory;
static PyObject *__pyx_n_s__game;
static PyObject *__pyx_n_s__gc;
static PyObject *__pyx_n_s__get_objects;
static PyObject *__pyx_n_s__get_size;
static PyObject *__pyx_n_s__get_time;
static PyObject *__pyx_n_s__h;
static PyObject *__pyx_n_s__height;
static PyObject *__pyx_n_s__heighto;
static PyObject *__pyx_n_s__id;
static PyObject *__pyx_n_s__imagelike;
static PyObject *__pyx_n_s__index;
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__kill_cache;
static PyObject *__pyx_n_s__layer_name;
static PyObject *__pyx_n_s__layers;
static PyObject *__pyx_n_s__line;
static PyObject *__pyx_n_s__lines;
static PyObject *__pyx_n_s__main;
static PyObject *__pyx_n_s__mark_sweep;
static PyObject *__pyx_n_s__mask;
static PyObject *__pyx_n_s__mutated_surface;
static PyObject *__pyx_n_s__mx;
static PyObject *__pyx_n_s__my;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__opaque;
static PyObject *__pyx_n_s__parents;
static PyObject *__pyx_n_s__pgrender;
static PyObject *__pyx_n_s__pointlist;
static PyObject *__pyx_n_s__polygon;
static PyObject *__pyx_n_s__pos;
static PyObject *__pyx_n_s__process_redraws;
static PyObject *__pyx_n_s__pygame;
static PyObject *__pyx_n_s__pygame_surface;
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__release;
static PyObject *__pyx_n_s__render;
static PyObject *__pyx_n_s__render_cache;
static PyObject *__pyx_n_s__render_of;
static PyObject *__pyx_n_s__render_screen;
static PyObject *__pyx_n_s__render_to_texture;
static PyObject *__pyx_n_s__renpy;
static PyObject *__pyx_n_s__reverse;
static PyObject *__pyx_n_s__root;
static PyObject *__pyx_n_s__screen_render;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__sort;
static PyObject *__pyx_n_s__source;
static PyObject *__pyx_n_s__st;
static PyObject *__pyx_n_s__start_angle;
static PyObject *__pyx_n_s__start_pos;
static PyObject *__pyx_n_s__startpos;
static PyObject *__pyx_n_s__stop_angle;
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__sx0;
static PyObject *__pyx_n_s__take_focuses;
static PyObject *__pyx_n_s__threading;
static PyObject *__pyx_n_s__transform;
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__x;
static PyObject *__pyx_n_s__xdx;
static PyObject *__pyx_n_s__xdy;
static PyObject *__pyx_n_s__xmaximum;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__ydx;
static PyObject *__pyx_n_s__ydy;
static PyObject *__pyx_n_s__ymaximum;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static int __pyx_k_3;
static PyObject *__pyx_k_7;
static PyObject *__pyx_k_8;
static PyObject *__pyx_k_11;
static PyObject *__pyx_k_12;
static PyObject *__pyx_k_13;
static PyObject *__pyx_k_14;
static PyObject *__pyx_k_15;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_17;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_20;
static PyObject *__pyx_k_tuple_22;

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

static PyObject *__pyx_pf_5renpy_7display_6render_free_memory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_free_memory[] = "\n    Frees memory used by the render system.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_free_memory = {__Pyx_NAMESTR("free_memory"), (PyCFunction)__pyx_pf_5renpy_7display_6render_free_memory, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_free_memory)};
static PyObject *__pyx_pf_5renpy_7display_6render_free_memory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("free_memory");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":59
 * 
 *     global screen_render
 *     screen_render = None             # <<<<<<<<<<<<<<
 * 
 *     mark_sweep()
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__screen_render, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":61
 *     screen_render = None
 * 
 *     mark_sweep()             # <<<<<<<<<<<<<<
 * 
 *     render_cache.clear()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__mark_sweep); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __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":63
 *     mark_sweep()
 * 
 *     render_cache.clear()             # <<<<<<<<<<<<<<
 * 
 *     # This can hang onto a render.
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __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":66
 * 
 *     # This can hang onto a render.
 *     renpy.display.interface.surftree = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__interface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__surftree, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __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_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":69
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_1check_at_shutdown(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_1check_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_1check_at_shutdown = {__Pyx_NAMESTR("check_at_shutdown"), (PyCFunction)__pyx_pf_5renpy_7display_6render_1check_at_shutdown, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_1check_at_shutdown)};
static PyObject *__pyx_pf_5renpy_7display_6render_1check_at_shutdown(PyObject *__pyx_self, CYTHON_UNUSED PyObject *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;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("check_at_shutdown");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":75
 *     """
 * 
 *     if not renpy.config.developer:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__config); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__developer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

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

  /* "renpy/display/render.pyx":78
 *         return
 * 
 *     free_memory()             # <<<<<<<<<<<<<<
 * 
 *     gc.collect()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__free_memory); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __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":80
 *     free_memory()
 * 
 *     gc.collect()             # <<<<<<<<<<<<<<
 *     l = gc.get_objects()
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__collect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __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":81
 * 
 *     gc.collect()
 *     l = gc.get_objects()             # <<<<<<<<<<<<<<
 * 
 *     count = 0
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get_objects); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_l = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":83
 *     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":84
 * 
 *     count = 0
 *     objects = gc.get_objects()             # <<<<<<<<<<<<<<
 * 
 *     for i in objects:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get_objects); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_objects = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":86
 *     objects = gc.get_objects()
 * 
 *     for i in objects:             # <<<<<<<<<<<<<<
 *         if isinstance(i, Render):
 *             count += 1
 */
  if (PyList_CheckExact(__pyx_v_objects) || PyTuple_CheckExact(__pyx_v_objects)) {
    __pyx_t_2 = __pyx_v_objects; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_objects); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
    } else {
      __pyx_t_1 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_1;
    __pyx_t_1 = 0;

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

      /* "renpy/display/render.pyx":88
 *     for i in objects:
 *         if isinstance(i, Render):
 *             count += 1             # <<<<<<<<<<<<<<
 * 
 *     if count:
 */
      __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_count, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_count);
      __pyx_v_count = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":90
 *             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_4 = __Pyx_PyObject_IsTrue(__pyx_v_count); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":91
 * 
 *     if count:
 *         raise Exception("%d Renders are alive at shutdown. This is probably a memory leak bug in Ren'Py." % count)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_v_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  __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_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":95
 * 
 * 
 * cpdef render(d, object widtho, object heighto, double st, double at):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */

static PyObject *__pyx_pf_5renpy_7display_6render_2render(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, 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_style = NULL;
  PyObject *__pyx_v_xmaximum = NULL;
  PyObject *__pyx_v_ymaximum = 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;
  float __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("render");
  __Pyx_INCREF(__pyx_v_widtho);
  __Pyx_INCREF(__pyx_v_heighto);

  /* "renpy/display/render.pyx":122
 *     cdef Render rv
 * 
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)             # <<<<<<<<<<<<<<
 * 
 *     render_cache_d = render_cache[d]
 */
  __pyx_t_1 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_st)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_at)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_widtho);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_widtho);
  __Pyx_GIVEREF(__pyx_v_widtho);
  __Pyx_INCREF(__pyx_v_heighto);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_heighto);
  __Pyx_GIVEREF(__pyx_v_heighto);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_v_orig_wh = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":124
 *     orig_wh = (widtho, heighto, frame_time-st, frame_time-at)
 * 
 *     render_cache_d = render_cache[d]             # <<<<<<<<<<<<<<
 *     rv = render_cache_d.get(orig_wh, None)
 * 
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetItem(__pyx_t_3, __pyx_v_d); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_render_cache_d = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":125
 * 
 *     render_cache_d = render_cache[d]
 *     rv = render_cache_d.get(orig_wh, None)             # <<<<<<<<<<<<<<
 * 
 *     if rv is not None:
 */
  if (unlikely(((PyObject *)__pyx_v_render_cache_d) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_2 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_render_cache_d), ((PyObject *)__pyx_v_orig_wh), Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_rv = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_2);
  __pyx_t_2 = 0;

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

    /* "renpy/display/render.pyx":128
 * 
 *     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;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":130
 *         return rv
 * 
 *     orig_width = width = widtho             # <<<<<<<<<<<<<<
 *     orig_height = height = heighto
 * 
 */
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_widtho); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_orig_width = __pyx_t_5;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_widtho); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_width = __pyx_t_5;

  /* "renpy/display/render.pyx":131
 * 
 *     orig_width = width = widtho
 *     orig_height = height = heighto             # <<<<<<<<<<<<<<
 * 
 *     style = d.style
 */
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_heighto); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_orig_height = __pyx_t_5;
  __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_heighto); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_height = __pyx_t_5;

  /* "renpy/display/render.pyx":133
 *     orig_height = height = heighto
 * 
 *     style = d.style             # <<<<<<<<<<<<<<
 *     xmaximum = style.xmaximum
 *     ymaximum = style.ymaximum
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_d, __pyx_n_s__style); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_style = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":134
 * 
 *     style = d.style
 *     xmaximum = style.xmaximum             # <<<<<<<<<<<<<<
 *     ymaximum = style.ymaximum
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_style, __pyx_n_s__xmaximum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_xmaximum = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":135
 *     style = d.style
 *     xmaximum = style.xmaximum
 *     ymaximum = style.ymaximum             # <<<<<<<<<<<<<<
 * 
 *     if xmaximum is not None:
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_style, __pyx_n_s__ymaximum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ymaximum = __pyx_t_2;
  __pyx_t_2 = 0;

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

    /* "renpy/display/render.pyx":138
 * 
 *     if xmaximum is not None:
 *         if isinstance(xmaximum, float):             # <<<<<<<<<<<<<<
 *             width = width * xmaximum
 *         else:
 */
    __pyx_t_2 = ((PyObject *)((PyObject*)(&PyFloat_Type)));
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_xmaximum, __pyx_t_2); 
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "renpy/display/render.pyx":139
 *     if xmaximum is not None:
 *         if isinstance(xmaximum, float):
 *             width = width * xmaximum             # <<<<<<<<<<<<<<
 *         else:
 *             width = min(xmaximum, width)
 */
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_width); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_xmaximum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_width = __pyx_t_5;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "renpy/display/render.pyx":141
 *             width = width * xmaximum
 *         else:
 *             width = min(xmaximum, width)             # <<<<<<<<<<<<<<
 * 
 *     if ymaximum is not None:
 */
      __pyx_t_5 = __pyx_v_width;
      __Pyx_INCREF(__pyx_v_xmaximum);
      __pyx_t_3 = __pyx_v_xmaximum;
      __pyx_t_1 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (__pyx_t_4) {
        __pyx_t_6 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_2 = __pyx_t_6;
        __pyx_t_6 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_width = __pyx_t_5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

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

    /* "renpy/display/render.pyx":144
 * 
 *     if ymaximum is not None:
 *         if isinstance(ymaximum, float):             # <<<<<<<<<<<<<<
 *             height = height * ymaximum
 *         else:
 */
    __pyx_t_2 = ((PyObject *)((PyObject*)(&PyFloat_Type)));
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_ymaximum, __pyx_t_2); 
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_4) {

      /* "renpy/display/render.pyx":145
 *     if ymaximum is not None:
 *         if isinstance(ymaximum, float):
 *             height = height * ymaximum             # <<<<<<<<<<<<<<
 *         else:
 *             height = min(ymaximum, height)
 */
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_ymaximum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_height = __pyx_t_5;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "renpy/display/render.pyx":147
 *             height = height * ymaximum
 *         else:
 *             height = min(ymaximum, height)             # <<<<<<<<<<<<<<
 * 
 *     if width < 0:
 */
      __pyx_t_5 = __pyx_v_height;
      __Pyx_INCREF(__pyx_v_ymaximum);
      __pyx_t_3 = __pyx_v_ymaximum;
      __pyx_t_6 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyObject_RichCompare(__pyx_t_6, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (__pyx_t_4) {
        __pyx_t_1 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = __pyx_t_1;
        __pyx_t_1 = 0;
      } else {
        __Pyx_INCREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_height = __pyx_t_5;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

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

    /* "renpy/display/render.pyx":150
 * 
 *     if width < 0:
 *         width = 0             # <<<<<<<<<<<<<<
 *     if height < 0:
 *         height = 0
 */
    __pyx_v_width = 0.0;
    goto __pyx_L8;
  }
  __pyx_L8:;

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

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

  /* "renpy/display/render.pyx":154
 *         height = 0
 * 
 *     if orig_width != width or orig_height != height:             # <<<<<<<<<<<<<<
 *         widtho = width
 *         heighto = height
 */
  __pyx_t_4 = (__pyx_v_orig_width != __pyx_v_width);
  if (!__pyx_t_4) {
    __pyx_t_7 = (__pyx_v_orig_height != __pyx_v_height);
    __pyx_t_8 = __pyx_t_7;
  } else {
    __pyx_t_8 = __pyx_t_4;
  }
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":155
 * 
 *     if orig_width != width or orig_height != height:
 *         widtho = width             # <<<<<<<<<<<<<<
 *         heighto = height
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)
 */
    __pyx_t_2 = PyFloat_FromDouble(__pyx_v_width); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_widtho);
    __pyx_v_widtho = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":156
 *     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_2 = PyFloat_FromDouble(__pyx_v_height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_heighto);
    __pyx_v_heighto = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/display/render.pyx":157
 *         widtho = width
 *         heighto = height
 *         wh = (widtho, heighto, frame_time-st, frame_time-at)             # <<<<<<<<<<<<<<
 *         rv = render_cache_d.get(wh, None)
 * 
 */
    __pyx_t_2 = PyFloat_FromDouble((__pyx_v_5renpy_7display_6render_frame_time - __pyx_v_st)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_widtho);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_widtho);
    __Pyx_GIVEREF(__pyx_v_widtho);
    __Pyx_INCREF(__pyx_v_heighto);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_heighto);
    __Pyx_GIVEREF(__pyx_v_heighto);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_v_wh = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":158
 *         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(((PyObject *)__pyx_v_render_cache_d) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "get"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = __Pyx_PyDict_GetItemDefault(((PyObject *)__pyx_v_render_cache_d), ((PyObject *)__pyx_v_wh), Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_rv));
    __pyx_v_rv = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_1);
    __pyx_t_1 = 0;

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

      /* "renpy/display/render.pyx":161
 * 
 *         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;
      goto __pyx_L11;
    }
    __pyx_L11:;
    goto __pyx_L10;
  }
  /*else*/ {

    /* "renpy/display/render.pyx":164
 * 
 *     else:
 *         wh = orig_wh             # <<<<<<<<<<<<<<
 * 
 *     rv = d.render(widtho, heighto, st, at)
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_orig_wh));
    __pyx_v_wh = __pyx_v_orig_wh;
  }
  __pyx_L10:;

  /* "renpy/display/render.pyx":166
 *         wh = orig_wh
 * 
 *     rv = d.render(widtho, heighto, st, at)             # <<<<<<<<<<<<<<
 * 
 *     rv.render_of.append(d)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_d, __pyx_n_s__render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(__pyx_v_st); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyFloat_FromDouble(__pyx_v_at); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = PyTuple_New(4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(__pyx_v_widtho);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_widtho);
  __Pyx_GIVEREF(__pyx_v_widtho);
  __Pyx_INCREF(__pyx_v_heighto);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_heighto);
  __Pyx_GIVEREF(__pyx_v_heighto);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5renpy_7display_6render_Render))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_rv));
  __pyx_v_rv = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":168
 *     rv = d.render(widtho, heighto, st, at)
 * 
 *     rv.render_of.append(d)             # <<<<<<<<<<<<<<
 * 
 *     if style.clipping:
 */
  __pyx_t_2 = __Pyx_PyObject_Append(__pyx_v_rv->render_of, __pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":170
 *     rv.render_of.append(d)
 * 
 *     if style.clipping:             # <<<<<<<<<<<<<<
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_style, __pyx_n_s__clipping); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":171
 * 
 *     if style.clipping:
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)             # <<<<<<<<<<<<<<
 *         rv.render_of.append(d)
 * 
 */
    __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_rv), __pyx_n_s__subsurface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = PyFloat_FromDouble(__pyx_v_rv->width); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_rv->height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_6 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__focus), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5renpy_7display_6render_Render))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_rv));
    __pyx_v_rv = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "renpy/display/render.pyx":172
 *     if style.clipping:
 *         rv = rv.subsurface((0, 0, rv.width, rv.height), focus=True)
 *         rv.render_of.append(d)             # <<<<<<<<<<<<<<
 * 
 *     render_cache_d[wh] = rv
 */
    __pyx_t_6 = __Pyx_PyObject_Append(__pyx_v_rv->render_of, __pyx_v_d); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "renpy/display/render.pyx":174
 *         rv.render_of.append(d)
 * 
 *     render_cache_d[wh] = rv             # <<<<<<<<<<<<<<
 * 
 *     if wh is not orig_wh:
 */
  if (PyDict_SetItem(((PyObject *)__pyx_v_render_cache_d), ((PyObject *)__pyx_v_wh), ((PyObject *)__pyx_v_rv)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

    /* "renpy/display/render.pyx":177
 * 
 *     if wh is not orig_wh:
 *         render_cache_d[orig_wh] = rv             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
    if (PyDict_SetItem(((PyObject *)__pyx_v_render_cache_d), ((PyObject *)__pyx_v_orig_wh), ((PyObject *)__pyx_v_rv)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "renpy/display/render.pyx":179
 *         render_cache_d[orig_wh] = rv
 * 
 *     return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_rv));
  __pyx_r = ((PyObject *)__pyx_v_rv);
  goto __pyx_L0;

  __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_6);
  __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_style);
  __Pyx_XDECREF(__pyx_v_xmaximum);
  __Pyx_XDECREF(__pyx_v_ymaximum);
  __Pyx_XDECREF(__pyx_v_widtho);
  __Pyx_XDECREF(__pyx_v_heighto);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_2render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_2render[] = "\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_pf_5renpy_7display_6render_2render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_widtho = 0;
  PyObject *__pyx_v_heighto = 0;
  double __pyx_v_st;
  double __pyx_v_at;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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};
  __Pyx_RefNannySetupContext("render");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__d);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__widtho);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__heighto);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__st);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__at);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "render") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_at = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_at == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __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_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_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_3invalidate(PyObject *__pyx_self, PyObject *__pyx_v_d); /*proto*/
static char __pyx_doc_5renpy_7display_6render_3invalidate[] = "\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_3invalidate = {__Pyx_NAMESTR("invalidate"), (PyCFunction)__pyx_pf_5renpy_7display_6render_3invalidate, METH_O, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_3invalidate)};
static PyObject *__pyx_pf_5renpy_7display_6render_3invalidate(PyObject *__pyx_self, PyObject *__pyx_v_d) {
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("invalidate");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":195
 *     global invalidated
 * 
 *     if d in render_cache:             # <<<<<<<<<<<<<<
 *         for v in render_cache[d].values():
 *             v.kill_cache()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = ((PySequence_Contains(__pyx_t_1, __pyx_v_d))); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":196
 * 
 *     if d in render_cache:
 *         for v in render_cache[d].values():             # <<<<<<<<<<<<<<
 *             v.kill_cache()
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_GetItem(__pyx_t_1, __pyx_v_d); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else if (PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
      } else {
        __pyx_t_3 = __pyx_t_5(__pyx_t_1);
        if (unlikely(!__pyx_t_3)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "renpy/display/render.pyx":197
 *     if d in render_cache:
 *         for v in render_cache[d].values():
 *             v.kill_cache()             # <<<<<<<<<<<<<<
 * 
 *         invalidated = True
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_v, __pyx_n_s__kill_cache); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":199
 *             v.kill_cache()
 * 
 *         invalidated = True             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s__invalidated, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __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":202
 * 
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Called to determine if any redraws are pending. Returns true if we
 */

static PyObject *__pyx_pf_5renpy_7display_6render_4process_redraws(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_4process_redraws[] = "\n    Called to determine if any redraws are pending. Returns true if we\n    need to redraw the screen now, false otherwise.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_4process_redraws = {__Pyx_NAMESTR("process_redraws"), (PyCFunction)__pyx_pf_5renpy_7display_6render_4process_redraws, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_4process_redraws)};
static PyObject *__pyx_pf_5renpy_7display_6render_4process_redraws(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_now = NULL;
  PyObject *__pyx_v_rv = NULL;
  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_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("process_redraws");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":210
 *     global redraw_queue
 * 
 *     redraw_queue.sort()             # <<<<<<<<<<<<<<
 * 
 *     now = renpy.display.core.get_time()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__redraw_queue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __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":212
 *     redraw_queue.sort()
 * 
 *     now = renpy.display.core.get_time()             # <<<<<<<<<<<<<<
 *     rv = invalidated
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__core); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__get_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_now = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":213
 * 
 *     now = renpy.display.core.get_time()
 *     rv = invalidated             # <<<<<<<<<<<<<<
 * 
 *     new_redraw_queue = [ ]
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__invalidated); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":215
 *     rv = invalidated
 * 
 *     new_redraw_queue = [ ]             # <<<<<<<<<<<<<<
 *     seen = set()
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_new_redraw_queue = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":216
 * 
 *     new_redraw_queue = [ ]
 *     seen = set()             # <<<<<<<<<<<<<<
 * 
 *     for t in redraw_queue:
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_seen = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":218
 *     seen = set()
 * 
 *     for t in redraw_queue:             # <<<<<<<<<<<<<<
 *         when, d = t
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__redraw_queue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_t);
    __pyx_v_t = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":219
 * 
 *     for t in redraw_queue:
 *         when, d = t             # <<<<<<<<<<<<<<
 * 
 *         if d in seen:
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_t))) || (PyList_CheckExact(__pyx_v_t))) {
      PyObject* sequence = __pyx_v_t;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_5);
    } else {
      Py_ssize_t index = -1;
      __pyx_t_6 = PyObject_GetIter(__pyx_v_t); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_1)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L8_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_when);
    __pyx_v_when = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_v_d);
    __pyx_v_d = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":221
 *         when, d = t
 * 
 *         if d in seen:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_8 = ((PySequence_Contains(((PyObject *)__pyx_v_seen), __pyx_v_d))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_8) {

      /* "renpy/display/render.pyx":222
 * 
 *         if d in seen:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         seen.add(d)
 */
      goto __pyx_L5_continue;
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "renpy/display/render.pyx":224
 *             continue
 * 
 *         seen.add(d)             # <<<<<<<<<<<<<<
 * 
 *         if d not in render_cache:
 */
    if (unlikely(((PyObject *)__pyx_v_seen) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "add"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_9 = PySet_Add(__pyx_v_seen, __pyx_v_d); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/display/render.pyx":226
 *         seen.add(d)
 * 
 *         if d not in render_cache:             # <<<<<<<<<<<<<<
 *             continue
 * 
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_t_5, __pyx_v_d))); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {

      /* "renpy/display/render.pyx":227
 * 
 *         if d not in render_cache:
 *             continue             # <<<<<<<<<<<<<<
 * 
 *         if when <= now:
 */
      goto __pyx_L5_continue;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "renpy/display/render.pyx":229
 *             continue
 * 
 *         if when <= now:             # <<<<<<<<<<<<<<
 *             # Remove this displayable and all its parents from the
 *             # render cache. But don't kill them yet, as that will kill the
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_when, __pyx_v_now, Py_LE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_8) {

      /* "renpy/display/render.pyx":234
 *             # children that we want to reuse.
 * 
 *             for v in render_cache[d].values():             # <<<<<<<<<<<<<<
 *                 v.kill_cache()
 * 
 */
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = PyObject_GetItem(__pyx_t_5, __pyx_v_d); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__values); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
        __pyx_t_5 = __pyx_t_1; __Pyx_INCREF(__pyx_t_5); __pyx_t_10 = 0;
        __pyx_t_11 = NULL;
      } else {
        __pyx_t_10 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_11 = Py_TYPE(__pyx_t_5)->tp_iternext;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      for (;;) {
        if (PyList_CheckExact(__pyx_t_5)) {
          if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_5)) break;
          __pyx_t_1 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++;
        } else if (PyTuple_CheckExact(__pyx_t_5)) {
          if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++;
        } else {
          __pyx_t_1 = __pyx_t_11(__pyx_t_5);
          if (unlikely(!__pyx_t_1)) {
            if (PyErr_Occurred()) {
              if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
              else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            break;
          }
          __Pyx_GOTREF(__pyx_t_1);
        }
        __Pyx_XDECREF(__pyx_v_v);
        __pyx_v_v = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "renpy/display/render.pyx":235
 * 
 *             for v in render_cache[d].values():
 *                 v.kill_cache()             # <<<<<<<<<<<<<<
 * 
 *             rv = True
 */
        __pyx_t_1 = PyObject_GetAttr(__pyx_v_v, __pyx_n_s__kill_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":237
 *                 v.kill_cache()
 * 
 *             rv = True             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_rv);
      __pyx_v_rv = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L11;
    }
    /*else*/ {

      /* "renpy/display/render.pyx":240
 * 
 *         else:
 *             new_redraw_queue.append(t)             # <<<<<<<<<<<<<<
 * 
 *         redraw_queue = new_redraw_queue
 */
      if (unlikely(((PyObject *)__pyx_v_new_redraw_queue) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_9 = PyList_Append(__pyx_v_new_redraw_queue, __pyx_v_t); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L11:;

    /* "renpy/display/render.pyx":242
 *             new_redraw_queue.append(t)
 * 
 *         redraw_queue = new_redraw_queue             # <<<<<<<<<<<<<<
 * 
 * 
 */
    if (PyObject_SetAttr(__pyx_m, __pyx_n_s__redraw_queue, ((PyObject *)__pyx_v_new_redraw_queue)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L5_continue:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.display.render.process_redraws", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_now);
  __Pyx_XDECREF(__pyx_v_rv);
  __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_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_5redraw_time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_5redraw_time[] = "\n    Returns the time at which the next redraw is scheduled.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_5redraw_time = {__Pyx_NAMESTR("redraw_time"), (PyCFunction)__pyx_pf_5renpy_7display_6render_5redraw_time, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_5redraw_time)};
static PyObject *__pyx_pf_5renpy_7display_6render_5redraw_time(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  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");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":253
 *     """
 * 
 *     if redraw_queue:             # <<<<<<<<<<<<<<
 *         return redraw_queue[0][0]
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__redraw_queue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":254
 * 
 *     if redraw_queue:
 *         return redraw_queue[0][0]             # <<<<<<<<<<<<<<
 * 
 *     return None
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__redraw_queue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __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, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __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;
    goto __pyx_L5;
  }
  __pyx_L5:;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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":259
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6redraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6redraw[] = "\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_6redraw = {__Pyx_NAMESTR("redraw"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6redraw, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6redraw)};
static PyObject *__pyx_pf_5renpy_7display_6render_6redraw(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_when = 0;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__d,&__pyx_n_s__when,0};
  __Pyx_RefNannySetupContext("redraw");
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__d);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__when);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("redraw", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "redraw") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":267
 *     """
 * 
 *     if not renpy.game.interface:             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__game); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__interface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = (!__pyx_t_3);
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":268
 * 
 *     if not renpy.game.interface:
 *         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;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":270
 *         return
 * 
 *     redraw_queue.append((when + renpy.game.interface.frame_time, d))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__redraw_queue); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__game); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__interface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__frame_time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_1, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __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":279
 *     """
 * 
 *     def __getstate__(self):             # <<<<<<<<<<<<<<
 *         return dict(
 *             xdx = self.xdx,
 */

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D___getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D___getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__getstate__");

  /* "renpy/display/render.pyx":280
 * 
 *     def __getstate__(self):
 *         return dict(             # <<<<<<<<<<<<<<
 *             xdx = self.xdx,
 *             xdy = self.xdy,
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));

  /* "renpy/display/render.pyx":281
 *     def __getstate__(self):
 *         return dict(
 *             xdx = self.xdx,             # <<<<<<<<<<<<<<
 *             xdy = self.xdy,
 *             ydx = self.ydx,
 */
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__xdx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":282
 *         return dict(
 *             xdx = self.xdx,
 *             xdy = self.xdy,             # <<<<<<<<<<<<<<
 *             ydx = self.ydx,
 *             ydy = self.ydy)
 */
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__xdy), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":283
 *             xdx = self.xdx,
 *             xdy = self.xdy,
 *             ydx = self.ydx,             # <<<<<<<<<<<<<<
 *             ydy = self.ydy)
 * 
 */
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ydx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":284
 *             xdy = self.xdy,
 *             ydx = self.ydx,
 *             ydy = self.ydy)             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, state):
 */
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__ydy), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_1__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_1__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__setstate__");

  /* "renpy/display/render.pyx":287
 * 
 *     def __setstate__(self, state):
 *         self.xdx = state['xdx']             # <<<<<<<<<<<<<<
 *         self.xdy = state['xdy']
 *         self.ydx = state['ydx']
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__xdx)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx = __pyx_t_2;

  /* "renpy/display/render.pyx":288
 *     def __setstate__(self, state):
 *         self.xdx = state['xdx']
 *         self.xdy = state['xdy']             # <<<<<<<<<<<<<<
 *         self.ydx = state['ydx']
 *         self.ydy = state['ydy']
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__xdy)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy = __pyx_t_2;

  /* "renpy/display/render.pyx":289
 *         self.xdx = state['xdx']
 *         self.xdy = state['xdy']
 *         self.ydx = state['ydx']             # <<<<<<<<<<<<<<
 *         self.ydy = state['ydy']
 * 
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__ydx)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx = __pyx_t_2;

  /* "renpy/display/render.pyx":290
 *         self.xdy = state['xdy']
 *         self.ydx = state['ydx']
 *         self.ydy = state['ydy']             # <<<<<<<<<<<<<<
 * 
 *     def __init__(Matrix2D self, double xdx, double xdy, double ydx, double ydy):
 */
  __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__ydy)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy = __pyx_t_2;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_2__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_xdx;
  double __pyx_v_xdy;
  double __pyx_v_ydx;
  double __pyx_v_ydy;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__xdx,&__pyx_n_s__xdy,&__pyx_n_s__ydx,&__pyx_n_s__ydy,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xdx);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xdy);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ydx);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ydy);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_xdx = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_xdx == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_xdy = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_xdy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_ydx = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_ydx == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_ydy = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_ydy == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

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

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

  /* "renpy/display/render.pyx":295
 *         self.xdx = xdx
 *         self.xdy = xdy
 *         self.ydx = ydx             # <<<<<<<<<<<<<<
 *         self.ydy = ydy
 * 
 */
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx = __pyx_v_ydx;

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

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5renpy_7display_6render_8Matrix2D_transform(struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("transform");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_7display_6render_8Matrix2D_3transform)) {
      __Pyx_XDECREF(((PyObject *)__pyx_r));
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_r = ((PyObject*)__pyx_t_3);
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":299
 * 
 *     cpdef tuple transform(Matrix2D self, double x, double y):
 *         return (x * self.xdx + y * self.xdy), (x * self.ydx + y * self.ydy)             # <<<<<<<<<<<<<<
 * 
 *     def __mul__(Matrix2D self, Matrix2D other):
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyFloat_FromDouble(((__pyx_v_x * __pyx_v_self->xdx) + (__pyx_v_y * __pyx_v_self->xdy))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(((__pyx_v_x * __pyx_v_self->ydx) + (__pyx_v_y * __pyx_v_self->ydy))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  double __pyx_v_x;
  double __pyx_v_y;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("transform");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->__pyx_vtab)->transform(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self), __pyx_v_x, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.transform", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_4__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_4__mul__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__mul__");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_5renpy_7display_6render_Matrix2D, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_5renpy_7display_6render_Matrix2D, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "renpy/display/render.pyx":303
 *     def __mul__(Matrix2D self, Matrix2D other):
 *         return Matrix2D(
 *             other.xdx * self.xdx + other.xdy * self.ydx,             # <<<<<<<<<<<<<<
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 *             other.ydx * self.xdx + other.ydy * self.ydx,
 */
  __pyx_t_1 = PyFloat_FromDouble(((((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->xdx * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx) + (((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->xdy * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "renpy/display/render.pyx":304
 *         return Matrix2D(
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 *             other.xdx * self.xdy + other.xdy * self.ydy,             # <<<<<<<<<<<<<<
 *             other.ydx * self.xdx + other.ydy * self.ydx,
 *             other.ydx * self.xdy + other.ydy * self.ydy)
 */
  __pyx_t_2 = PyFloat_FromDouble(((((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->xdx * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy) + (((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->xdy * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "renpy/display/render.pyx":305
 *             other.xdx * self.xdx + other.xdy * self.ydx,
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 *             other.ydx * self.xdx + other.ydy * self.ydx,             # <<<<<<<<<<<<<<
 *             other.ydx * self.xdy + other.ydy * self.ydy)
 * 
 */
  __pyx_t_3 = PyFloat_FromDouble(((((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->ydx * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx) + (((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->ydy * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "renpy/display/render.pyx":306
 *             other.xdx * self.xdy + other.xdy * self.ydy,
 *             other.ydx * self.xdx + other.ydy * self.ydx,
 *             other.ydx * self.xdy + other.ydy * self.ydy)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self):
 */
  __pyx_t_4 = PyFloat_FromDouble(((((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->ydx * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy) + (((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_other)->ydy * ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Matrix2D)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_5__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_5__repr__(PyObject *__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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "renpy/display/render.pyx":309
 * 
 *     def __repr__(self):
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)             # <<<<<<<<<<<<<<
 * 
 * IDENTITY = Matrix2D(1, 0, 0, 1)
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_r = ((PyObject *)__pyx_t_4);
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.xdx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx = __pyx_t_1;

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.xdy.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy = __pyx_t_1;

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.ydx.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx = __pyx_t_1;

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.ydy.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Matrix2D.ydy.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":313
 * IDENTITY = Matrix2D(1, 0, 0, 1)
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_7take_focuses(PyObject *__pyx_self, PyObject *__pyx_v_focuses); /*proto*/
static char __pyx_doc_5renpy_7display_6render_7take_focuses[] = "\n    Adds a list of rectangular focus regions to the focuses list.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_7take_focuses = {__Pyx_NAMESTR("take_focuses"), (PyCFunction)__pyx_pf_5renpy_7display_6render_7take_focuses, METH_O, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_7take_focuses)};
static PyObject *__pyx_pf_5renpy_7display_6render_7take_focuses(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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("take_focuses");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":318
 *     """
 * 
 *     screen_render.take_focuses(             # <<<<<<<<<<<<<<
 *         0, 0, screen_render.width, screen_render.height,
 *         IDENTITY, 0, 0, focuses)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__screen_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__take_focuses); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":319
 * 
 *     screen_render.take_focuses(
 *         0, 0, screen_render.width, screen_render.height,             # <<<<<<<<<<<<<<
 *         IDENTITY, 0, 0, focuses)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__screen_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__screen_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":320
 *     screen_render.take_focuses(
 *         0, 0, screen_render.width, screen_render.height,
 *         IDENTITY, 0, 0, focuses)             # <<<<<<<<<<<<<<
 * 
 * # The result of focus_at_point for a modal render. This overrides any
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__IDENTITY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 5, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 6, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_v_focuses);
  PyTuple_SET_ITEM(__pyx_t_5, 7, __pyx_v_focuses);
  __Pyx_GIVEREF(__pyx_v_focuses);
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":326
 * Modal = object()
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */

static PyObject *__pyx_pf_5renpy_7display_6render_8focus_at_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_8focus_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_8focus_at_point = {__Pyx_NAMESTR("focus_at_point"), (PyCFunction)__pyx_pf_5renpy_7display_6render_8focus_at_point, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_8focus_at_point)};
static PyObject *__pyx_pf_5renpy_7display_6render_8focus_at_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_cf = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("focus_at_point");
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("focus_at_point", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "focus_at_point") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":332
 *     """
 * 
 *     if screen_render is None:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__screen_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __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;
  if (__pyx_t_2) {

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

  /* "renpy/display/render.pyx":335
 *         return None
 * 
 *     cf = screen_render.focus_at_point(x, y)             # <<<<<<<<<<<<<<
 *     if cf is None or cf is Modal:
 *         return None
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__screen_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__focus_at_point); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_cf = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":336
 * 
 *     cf = screen_render.focus_at_point(x, y)
 *     if cf is None or cf is Modal:             # <<<<<<<<<<<<<<
 *         return None
 *     else:
 */
  __pyx_t_2 = (__pyx_v_cf == Py_None);
  if (!__pyx_t_2) {
    __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__Modal); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = (__pyx_v_cf == __pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_t_5;
  } else {
    __pyx_t_6 = __pyx_t_2;
  }
  if (__pyx_t_6) {

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

    /* "renpy/display/render.pyx":339
 *         return None
 *     else:
 *         d, arg = cf             # <<<<<<<<<<<<<<
 *         return renpy.display.focus.Focus(d, arg, None, None, None, None)
 * 
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_cf))) || (PyList_CheckExact(__pyx_v_cf))) {
      PyObject* sequence = __pyx_v_cf;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __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 {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_v_cf); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_1 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L8_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L9_unpacking_done;
      __pyx_L8_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L9_unpacking_done:;
    }
    __pyx_v_d = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_arg = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":340
 *     else:
 *         d, arg = cf
 *         return renpy.display.focus.Focus(d, arg, None, None, None, None)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__focus); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__Focus); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __Pyx_INCREF(__pyx_v_d);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_d);
    __Pyx_GIVEREF(__pyx_v_d);
    __Pyx_INCREF(__pyx_v_arg);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_arg);
    __Pyx_GIVEREF(__pyx_v_arg);
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 3, Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 4, Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_1, 5, Py_None);
    __Pyx_GIVEREF(Py_None);
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __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_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_9mutated_surface(PyObject *__pyx_self, PyObject *__pyx_v_surf); /*proto*/
static char __pyx_doc_5renpy_7display_6render_9mutated_surface[] = "\n    Called to indicate that the given surface has changed. \n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_9mutated_surface = {__Pyx_NAMESTR("mutated_surface"), (PyCFunction)__pyx_pf_5renpy_7display_6render_9mutated_surface, METH_O, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_9mutated_surface)};
static PyObject *__pyx_pf_5renpy_7display_6render_9mutated_surface(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");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":348
 *     """
 * 
 *     renpy.display.draw.mutated_surface(surf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__draw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__mutated_surface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __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":351
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */

static PyObject *__pyx_pf_5renpy_7display_6render_10render_screen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_10render_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_10render_screen = {__Pyx_NAMESTR("render_screen"), (PyCFunction)__pyx_pf_5renpy_7display_6render_10render_screen, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_10render_screen)};
static PyObject *__pyx_pf_5renpy_7display_6render_10render_screen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_root = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_v_height = 0;
  PyObject *__pyx_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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__root,&__pyx_n_s__width,&__pyx_n_s__height,0};
  __Pyx_RefNannySetupContext("render_screen");
  __pyx_self = __pyx_self;
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__root);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_screen", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__height);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_screen", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "render_screen") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":364
 *     global frame_time
 * 
 *     frame_time = renpy.display.interface.frame_time             # <<<<<<<<<<<<<<
 * 
 *     rv = render(root, width, height, 0, 0)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__interface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__frame_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_5renpy_7display_6render_frame_time = __pyx_t_3;

  /* "renpy/display/render.pyx":366
 *     frame_time = renpy.display.interface.frame_time
 * 
 *     rv = render(root, width, height, 0, 0)             # <<<<<<<<<<<<<<
 *     screen_render = rv
 * 
 */
  __pyx_t_2 = __pyx_f_5renpy_7display_6render_render(__pyx_v_root, __pyx_v_width, __pyx_v_height, 0.0, 0.0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_rv = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":367
 * 
 *     rv = render(root, width, height, 0, 0)
 *     screen_render = rv             # <<<<<<<<<<<<<<
 * 
 *     invalidated = False
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__screen_render, __pyx_v_rv) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":369
 *     screen_render = rv
 * 
 *     invalidated = False             # <<<<<<<<<<<<<<
 * 
 *     rv.is_opaque()
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__invalidated, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":371
 *     invalidated = False
 * 
 *     rv.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *     return rv
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_rv, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __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":373
 *     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;

  __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_AddTraceback("renpy.display.render.render_screen", __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":375
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */

static PyObject *__pyx_pf_5renpy_7display_6render_11mark_sweep(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_11mark_sweep[] = "\n    This performs mark-and-sweep garbage collection on the live_renders\n    list.\n    ";
static PyMethodDef __pyx_mdef_5renpy_7display_6render_11mark_sweep = {__Pyx_NAMESTR("mark_sweep"), (PyCFunction)__pyx_pf_5renpy_7display_6render_11mark_sweep, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_11mark_sweep)};
static PyObject *__pyx_pf_5renpy_7display_6render_11mark_sweep(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  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;
  Py_ssize_t __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("mark_sweep");
  __pyx_self = __pyx_self;

  /* "renpy/display/render.pyx":387
 *     cdef Render r, j
 * 
 *     worklist = [ ]             # <<<<<<<<<<<<<<
 * 
 *     if screen_render is not None:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_worklist = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":389
 *     worklist = [ ]
 * 
 *     if screen_render is not None:             # <<<<<<<<<<<<<<
 *         worklist.append(screen_render)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__screen_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __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;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":390
 * 
 *     if screen_render is not None:
 *         worklist.append(screen_render)             # <<<<<<<<<<<<<<
 * 
 *     i = 0
 */
    if (unlikely(((PyObject *)__pyx_v_worklist) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__screen_render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyList_Append(__pyx_v_worklist, __pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

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

  /* "renpy/display/render.pyx":394
 *     i = 0
 * 
 *     while i < len(worklist):             # <<<<<<<<<<<<<<
 *         r = worklist[i]
 * 
 */
  while (1) {
    if (unlikely(((PyObject *)__pyx_v_worklist) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_4 = PyList_GET_SIZE(((PyObject *)__pyx_v_worklist)); 
    __pyx_t_2 = (__pyx_v_i < __pyx_t_4);
    if (!__pyx_t_2) break;

    /* "renpy/display/render.pyx":395
 * 
 *     while i < len(worklist):
 *         r = worklist[i]             # <<<<<<<<<<<<<<
 * 
 *         for j in r.depends_on_list:
 */
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_worklist), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_r));
    __pyx_v_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":397
 *         r = worklist[i]
 * 
 *         for j in r.depends_on_list:             # <<<<<<<<<<<<<<
 *             if not j.mark:
 *                 j.mark = True
 */
    if (unlikely(((PyObject *)__pyx_v_r->depends_on_list) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = ((PyObject *)__pyx_v_r->depends_on_list); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    for (;;) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5renpy_7display_6render_Render))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_XDECREF(((PyObject *)__pyx_v_j));
      __pyx_v_j = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_5);
      __pyx_t_5 = 0;

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

        /* "renpy/display/render.pyx":399
 *         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":400
 *             if not j.mark:
 *                 j.mark = True
 *                 worklist.append(j)             # <<<<<<<<<<<<<<
 * 
 *         i += 1
 */
        if (unlikely(((PyObject *)__pyx_v_worklist) == Py_None)) {
          PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
        }
        __pyx_t_3 = PyList_Append(__pyx_v_worklist, ((PyObject *)__pyx_v_j)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L10;
      }
      __pyx_L10:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":402
 *                 worklist.append(j)
 * 
 *         i += 1             # <<<<<<<<<<<<<<
 * 
 *     for r in live_renders:
 */
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "renpy/display/render.pyx":404
 *         i += 1
 * 
 *     for r in live_renders:             # <<<<<<<<<<<<<<
 *         if not r.mark:
 *             r.kill_cache()
 */
  if (unlikely(((PyObject *)__pyx_v_5renpy_7display_6render_live_renders) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)__pyx_v_5renpy_7display_6render_live_renders); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
  for (;;) {
    if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_5); __pyx_t_4++;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5renpy_7display_6render_Render))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_XDECREF(((PyObject *)__pyx_v_r));
    __pyx_v_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_t_5);
    __pyx_t_5 = 0;

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

      /* "renpy/display/render.pyx":406
 *     for r in live_renders:
 *         if not r.mark:
 *             r.kill_cache()             # <<<<<<<<<<<<<<
 *         else:
 *             r.mark = False
 */
      __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_r), __pyx_n_s__kill_cache); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L13;
    }
    /*else*/ {

      /* "renpy/display/render.pyx":408
 *             r.kill_cache()
 *         else:
 *             r.mark = False             # <<<<<<<<<<<<<<
 * 
 *     live_renders = worklist
 */
      __pyx_v_r->mark = 0;
    }
    __pyx_L13:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  __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_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":412
 *     live_renders = worklist
 * 
 * def compute_subline(sx0, sw, cx0, cw):             # <<<<<<<<<<<<<<
 *     """
 *     Given a source line (start sx0, width sw) and a crop line (cx0, cw),
 */

static PyObject *__pyx_pf_5renpy_7display_6render_12compute_subline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_12compute_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_12compute_subline = {__Pyx_NAMESTR("compute_subline"), (PyCFunction)__pyx_pf_5renpy_7display_6render_12compute_subline, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_12compute_subline)};
static PyObject *__pyx_pf_5renpy_7display_6render_12compute_subline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_sx0 = 0;
  PyObject *__pyx_v_sw = 0;
  PyObject *__pyx_v_cx0 = 0;
  PyObject *__pyx_v_cw = 0;
  PyObject *__pyx_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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__sx0,&__pyx_n_s__sw,&__pyx_n_s__cx0,&__pyx_n_s__cw,0};
  __Pyx_RefNannySetupContext("compute_subline");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sx0);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sw);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cx0);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cw);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("compute_subline", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "compute_subline") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":424
 *     """
 * 
 *     sx1 = sx0 + sw             # <<<<<<<<<<<<<<
 *     cx1 = cx0 + cw
 * 
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_sx0, __pyx_v_sw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_sx1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":425
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_cx1 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":427
 *     cx1 = cx0 + cw
 * 
 *     if sx0 > cx0:             # <<<<<<<<<<<<<<
 *         start = sx0
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_sx0, __pyx_v_cx0, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

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

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

  /* "renpy/display/render.pyx":432
 *         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_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_offset = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":433
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_crop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":435
 *     crop = start - sx0
 * 
 *     if sx1 < cx1:             # <<<<<<<<<<<<<<
 *         width = sx1 - start
 *     else:
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_sx1, __pyx_v_cx1, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":436
 * 
 *     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_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_width = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "renpy/display/render.pyx":438
 *         width = sx1 - start
 *     else:
 *         width = cx1 - start             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = PyNumber_Subtract(__pyx_v_cx1, __pyx_v_start); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_width = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L7:;

  /* "renpy/display/render.pyx":441
 * 
 * 
 *     return offset, crop, width             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_offset);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_offset);
  __Pyx_GIVEREF(__pyx_v_offset);
  __Pyx_INCREF(__pyx_v_crop);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_crop);
  __Pyx_GIVEREF(__pyx_v_crop);
  __Pyx_INCREF(__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_width);
  __Pyx_GIVEREF(__pyx_v_width);
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __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":454
 * cdef class Render:
 * 
 *     def __init__(Render self, float width, float height, draw_func=None, layer_name=None, bint opaque=None): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new render corresponding to the given widget with
 */

static int __pyx_pf_5renpy_7display_6render_6Render___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        ";
struct wrapperbase __pyx_wrapperbase_5renpy_7display_6render_6Render___init__;
static int __pyx_pf_5renpy_7display_6render_6Render___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  float __pyx_v_width;
  float __pyx_v_height;
  PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_v_layer_name = 0;
  int __pyx_v_opaque;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  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;
  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};
  __Pyx_RefNannySetupContext("__init__");
  {
    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;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__height);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__draw_func);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__layer_name);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__opaque);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_AsDouble(values[0]); if (unlikely((__pyx_v_width == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_height = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_height == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    } else {
      __pyx_v_opaque = __pyx_k_3;
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __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:;

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

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

  /* "renpy/display/render.pyx":471
 * 
 * 
 *         self.width = width             # <<<<<<<<<<<<<<
 *         self.height = height
 * 
 */
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width = __pyx_v_width;

  /* "renpy/display/render.pyx":472
 * 
 *         self.width = width
 *         self.height = height             # <<<<<<<<<<<<<<
 * 
 *         self.layer_name = layer_name
 */
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height = __pyx_v_height;

  /* "renpy/display/render.pyx":474
 *         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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name = __pyx_v_layer_name;

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

  /* "renpy/display/render.pyx":482
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":485
 * 
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":488
 * 
 *         # The operation we're performing. (BLIT, DISSOLVE, OR IMAGE_DISSOLVE)
 *         self.operation = BLIT             # <<<<<<<<<<<<<<
 * 
 *         # The fraction of the operation that is complete.
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__BLIT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation = __pyx_t_2;

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

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

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

  /* "renpy/display/render.pyx":507
 *         # 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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

  /* "renpy/display/render.pyx":508
 *         # 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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

  /* "renpy/display/render.pyx":511
 * 
 *         # This is used to adjust the alpha of children of this render.
 *         self.alpha = 1             # <<<<<<<<<<<<<<
 * 
 *         # A list of focus regions in this displayable.
 */
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha = 1.0;

  /* "renpy/display/render.pyx":514
 * 
 *         # 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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses = ((PyObject*)Py_None);

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

  /* "renpy/display/render.pyx":520
 * 
 *         # 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_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":524
 *         # 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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func = __pyx_v_draw_func;

  /* "renpy/display/render.pyx":529
 *         # 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
 */
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque = __pyx_v_opaque;

  /* "renpy/display/render.pyx":534
 *         # 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_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children;

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

  /* "renpy/display/render.pyx":540
 * 
 *         # 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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface = Py_None;

  /* "renpy/display/render.pyx":541
 *         # 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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface = Py_None;

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

  /* "renpy/display/render.pyx":548
 * 
 *         # Are we modal?
 *         self.modal = False             # <<<<<<<<<<<<<<
 * 
 *         live_renders.append(self)
 */
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->modal = 0;

  /* "renpy/display/render.pyx":550
 *         self.modal = False
 * 
 *         live_renders.append(self)             # <<<<<<<<<<<<<<
 * 
 *     def __repr__(self): #@DuplicatedSignature
 */
  if (unlikely(((PyObject *)__pyx_v_5renpy_7display_6render_live_renders) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_Append(__pyx_v_5renpy_7display_6render_live_renders, __pyx_v_self); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __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":552
 *         live_renders.append(self)
 * 
 *     def __repr__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return "<Render %x of %r>" % (id(self), self.render_of)
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_1__repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_1__repr__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__repr__");

  /* "renpy/display/render.pyx":553
 * 
 *     def __repr__(self): #@DuplicatedSignature
 *         return "<Render %x of %r>" % (id(self), self.render_of)             # <<<<<<<<<<<<<<
 * 
 *     def __getstate__(self): #@DuplicatedSignature
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_2 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  __Pyx_GIVEREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __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_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":555
 *         return "<Render %x of %r>" % (id(self), self.render_of)
 * 
 *     def __getstate__(self): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_2__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_2__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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__");

  /* "renpy/display/render.pyx":556
 * 
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:             # <<<<<<<<<<<<<<
 *             raise Exception("Can't pickle a Render.")
 *         else:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__config); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__developer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":557
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")             # <<<<<<<<<<<<<<
 *         else:
 *             return { }
 */
    __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  /*else*/ {

    /* "renpy/display/render.pyx":559
 *             raise Exception("Can't pickle a Render.")
 *         else:
 *             return { }             # <<<<<<<<<<<<<<
 * 
 *     def __setstate__(self, state): #@DuplicatedSignature
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_r = ((PyObject *)__pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L0;
  }
  __pyx_L5:;

  __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_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":561
 *             return { }
 * 
 *     def __setstate__(self, state): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         return
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_3__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_3__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate__");

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4blit(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 = __pyx_k_7;
  PyObject *__pyx_v_main = __pyx_k_8;
  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;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("blit");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_focus = __pyx_optional_args->focus;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_main = __pyx_optional_args->main;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_index = __pyx_optional_args->index;
        }
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__blit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_7display_6render_6Render_4blit)) {
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_source);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
      __Pyx_GIVEREF(__pyx_v_source);
      __Pyx_INCREF(((PyObject *)__pyx_v_pos));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_pos));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
      __Pyx_INCREF(__pyx_v_focus);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_focus);
      __Pyx_GIVEREF(__pyx_v_focus);
      __Pyx_INCREF(__pyx_v_main);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_main);
      __Pyx_GIVEREF(__pyx_v_main);
      __Pyx_INCREF(__pyx_v_index);
      PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_index);
      __Pyx_GIVEREF(__pyx_v_index);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":575
 *         """
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         if source is self:
 */
  if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_pos)))) {
    PyObject* sequence = ((PyObject *)__pyx_v_pos);
    if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
      if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
      else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
  } else {
    __Pyx_UnpackTupleError(((PyObject *)__pyx_v_pos), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_xo = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_yo = __pyx_t_3;
  __pyx_t_3 = 0;

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

    /* "renpy/display/render.pyx":578
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         xo = int(xo)
 */
    __pyx_t_3 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":580
 *             raise Exception("Blitting to self.")
 * 
 *         xo = int(xo)             # <<<<<<<<<<<<<<
 *         yo = int(yo)
 * 
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_xo);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_xo);
  __Pyx_GIVEREF(__pyx_v_xo);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_xo);
  __pyx_v_xo = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":581
 * 
 *         xo = int(xo)
 *         yo = int(yo)             # <<<<<<<<<<<<<<
 * 
 *         if index is None:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_yo);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_yo);
  __Pyx_GIVEREF(__pyx_v_yo);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_yo);
  __pyx_v_yo = __pyx_t_3;
  __pyx_t_3 = 0;

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

    /* "renpy/display/render.pyx":584
 * 
 *         if index is None:
 *             self.children.append((source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))
 */
    if (unlikely(((PyObject *)__pyx_v_self->children) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    __pyx_t_6 = PyList_Append(__pyx_v_self->children, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  /*else*/ {

    /* "renpy/display/render.pyx":586
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(source, Render):
 */
    if (unlikely(((PyObject *)__pyx_v_self->children) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "insert"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    __pyx_t_6 = PyList_Insert(__pyx_v_self->children, __pyx_t_7, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  }
  __pyx_L4:;

  /* "renpy/display/render.pyx":588
 *             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_3 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_source, __pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":589
 * 
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)             # <<<<<<<<<<<<<<
 *             source.parents.add(self)
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_self->depends_on_list) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_6 = PyList_Append(__pyx_v_self->depends_on_list, __pyx_v_source); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/display/render.pyx":590
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__parents); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

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

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("renpy.display.render.Render.blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_4blit[] = "\n        Blits `source` (a Render or Surface) to this Render, offset by\n        xo and yo.\n\n        If `focus` is true, then focuses are added from the child to the\n        parent.\n\n        This will only blit on integer pixel boundaries.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_v_main = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 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;
  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};
  __Pyx_RefNannySetupContext("blit");
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = __pyx_k_7;
    values[3] = __pyx_k_8;
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("blit", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__focus);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__main);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blit") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->__pyx_vtab)->blit(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_source, __pyx_v_pos, 1, &__pyx_t_2); 
  __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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.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":594
 *         return 0
 * 
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5subpixel_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 = __pyx_k_11;
  PyObject *__pyx_v_main = __pyx_k_12;
  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;
  int __pyx_t_4;
  double __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("subpixel_blit");
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_focus = __pyx_optional_args->focus;
      if (__pyx_optional_args->__pyx_n > 1) {
        __pyx_v_main = __pyx_optional_args->main;
        if (__pyx_optional_args->__pyx_n > 2) {
          __pyx_v_index = __pyx_optional_args->index;
        }
      }
    }
  }
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__subpixel_blit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_7display_6render_6Render_5subpixel_blit)) {
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_source);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_source);
      __Pyx_GIVEREF(__pyx_v_source);
      __Pyx_INCREF(((PyObject *)__pyx_v_pos));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_pos));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_pos));
      __Pyx_INCREF(__pyx_v_focus);
      PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_focus);
      __Pyx_GIVEREF(__pyx_v_focus);
      __Pyx_INCREF(__pyx_v_main);
      PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_main);
      __Pyx_GIVEREF(__pyx_v_main);
      __Pyx_INCREF(__pyx_v_index);
      PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_index);
      __Pyx_GIVEREF(__pyx_v_index);
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_4;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/display/render.pyx":605
 *         """
 * 
 *         (xo, yo) = pos             # <<<<<<<<<<<<<<
 * 
 *         xo = float(xo)
 */
  if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_pos)))) {
    PyObject* sequence = ((PyObject *)__pyx_v_pos);
    if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
      if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
      else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
  } else {
    __Pyx_UnpackTupleError(((PyObject *)__pyx_v_pos), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_xo = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_yo = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":607
 *         (xo, yo) = pos
 * 
 *         xo = float(xo)             # <<<<<<<<<<<<<<
 *         yo = float(yo)
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_xo); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_v_xo);
  __pyx_v_xo = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":608
 * 
 *         xo = float(xo)
 *         yo = float(yo)             # <<<<<<<<<<<<<<
 * 
 *         if index is None:
 */
  __pyx_t_5 = __Pyx_PyObject_AsDouble(__pyx_v_yo); if (unlikely(__pyx_t_5 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = PyFloat_FromDouble(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_v_yo);
  __pyx_v_yo = __pyx_t_3;
  __pyx_t_3 = 0;

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

    /* "renpy/display/render.pyx":611
 * 
 *         if index is None:
 *             self.children.append((source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))
 */
    if (unlikely(((PyObject *)__pyx_v_self->children) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    __pyx_t_7 = PyList_Append(__pyx_v_self->children, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "renpy/display/render.pyx":613
 *             self.children.append((source, xo, yo, focus, main))
 *         else:
 *             self.children.insert(index, (source, xo, yo, focus, main))             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(source, Render):
 */
    if (unlikely(((PyObject *)__pyx_v_self->children) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "insert"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = PyTuple_New(5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_source);
    __Pyx_GIVEREF(__pyx_v_source);
    __Pyx_INCREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    __Pyx_INCREF(__pyx_v_focus);
    PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_focus);
    __Pyx_GIVEREF(__pyx_v_focus);
    __Pyx_INCREF(__pyx_v_main);
    PyTuple_SET_ITEM(__pyx_t_3, 4, __pyx_v_main);
    __Pyx_GIVEREF(__pyx_v_main);
    __pyx_t_7 = PyList_Insert(__pyx_v_self->children, __pyx_t_8, ((PyObject *)__pyx_t_3)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  }
  __pyx_L3:;

  /* "renpy/display/render.pyx":615
 *             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_3 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_TypeCheck(__pyx_v_source, __pyx_t_3); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_6) {

    /* "renpy/display/render.pyx":616
 * 
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)             # <<<<<<<<<<<<<<
 *             source.parents.add(self)
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_self->depends_on_list) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_7 = PyList_Append(__pyx_v_self->depends_on_list, __pyx_v_source); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/display/render.pyx":617
 *         if isinstance(source, Render):
 *             self.depends_on_list.append(source)
 *             source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__parents); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__add); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(((PyObject *)__pyx_v_self));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
    __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

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

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("renpy.display.render.Render.subpixel_blit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5subpixel_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_5subpixel_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_pf_5renpy_7display_6render_6Render_5subpixel_blit(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_v_main = 0;
  PyObject *__pyx_v_index = 0;
  PyObject *__pyx_r = 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;
  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};
  __Pyx_RefNannySetupContext("subpixel_blit");
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[2] = __pyx_k_11;
    values[3] = __pyx_k_12;
    values[4] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("subpixel_blit", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__focus);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__main);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__index);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "subpixel_blit") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __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 = ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->__pyx_vtab)->subpixel_blit(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_source, __pyx_v_pos, 1, &__pyx_t_2); 
  __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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.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":621
 *         return 0
 * 
 *     def get_size(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the size of this Render, a mostly ficticious value
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_6get_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_pf_5renpy_7display_6render_6Render_6get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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");

  /* "renpy/display/render.pyx":628
 *         """
 * 
 *         return self.width, self.height             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_r = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __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.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":631
 * 
 * 
 *     def render_to_texture(self, alpha=True):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a texture constructed from this render. This may return
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7render_to_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_7render_to_texture[] = "\n        Returns a texture constructed from this render. This may return\n        a cached textue, if one has already been rendered.\n\n        `alpha` is a hint that controls if the surface should have\n        alpha or not.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7render_to_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_opaque = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_focus = NULL;
  PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_cw = NULL;
  PyObject *__pyx_v_ch = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  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)(PyObject *);
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alpha,0};
  __Pyx_RefNannySetupContext("render_to_texture");
  {
    PyObject* values[1] = {0};
    values[0] = __pyx_k_13;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "render_to_texture") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        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_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":640
 *         """
 * 
 *         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_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

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

      /* "renpy/display/render.pyx":642
 *         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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
      __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

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

      /* "renpy/display/render.pyx":645
 *         else:
 *             if self.surface is not None:
 *                 return self.surface             # <<<<<<<<<<<<<<
 * 
 *         rv = None
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
      __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":647
 *                 return self.surface
 * 
 *         rv = None             # <<<<<<<<<<<<<<
 * 
 *         opaque = self.is_opaque()
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_rv = Py_None;

  /* "renpy/display/render.pyx":649
 *         rv = None
 * 
 *         opaque = self.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         # If we can, reuse a child's texture.
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_opaque = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":652
 * 
 *         # If we can, reuse a child's texture.
 *         if opaque or alpha:             # <<<<<<<<<<<<<<
 * 
 *             if not self.forward and len(self.children) == 1:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_opaque); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (!__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_alpha); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = __pyx_t_4;
  } else {
    __pyx_t_5 = __pyx_t_1;
  }
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":654
 *         if opaque or alpha:
 * 
 *             if not self.forward and len(self.children) == 1:             # <<<<<<<<<<<<<<
 *                 child, x, y, focus, main = self.children[0]
 *                 cw, ch = child.get_size()
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (!__pyx_t_5);
    if (__pyx_t_1) {
      __pyx_t_3 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children);
      __Pyx_INCREF(__pyx_t_3);
      if (unlikely(__pyx_t_3 == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_6 = PyList_GET_SIZE(__pyx_t_3); 
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_5 = (__pyx_t_6 == 1);
      __pyx_t_4 = __pyx_t_5;
    } else {
      __pyx_t_4 = __pyx_t_1;
    }
    if (__pyx_t_4) {

      /* "renpy/display/render.pyx":655
 * 
 *             if not self.forward and len(self.children) == 1:
 *                 child, x, y, focus, main = self.children[0]             # <<<<<<<<<<<<<<
 *                 cw, ch = child.get_size()
 *                 if x <= 0 and y <= 0 and cw + x >= self.width and ch + y >= self.height:
 */
      __pyx_t_3 = __Pyx_GetItemInt_List(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
            if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_2 = 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); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
            if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_2 = 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_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_2 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 1; __pyx_t_7 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 2; __pyx_t_8 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 3; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 4; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L12_unpacking_done:;
      }
      __pyx_v_child = __pyx_t_2;
      __pyx_t_2 = 0;
      __pyx_v_x = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_v_y = __pyx_t_8;
      __pyx_t_8 = 0;
      __pyx_v_focus = __pyx_t_9;
      __pyx_t_9 = 0;
      __pyx_v_main = __pyx_t_10;
      __pyx_t_10 = 0;

      /* "renpy/display/render.pyx":656
 *             if not self.forward and len(self.children) == 1:
 *                 child, x, y, focus, main = self.children[0]
 *                 cw, ch = child.get_size()             # <<<<<<<<<<<<<<
 *                 if x <= 0 and y <= 0 and cw + x >= self.width and ch + y >= self.height:
 *                     # Our single child overlaps us.
 */
      __pyx_t_3 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__get_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_10 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
        PyObject* sequence = __pyx_t_10;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_8 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L14_unpacking_done;
        __pyx_L13_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L14_unpacking_done:;
      }
      __pyx_v_cw = __pyx_t_3;
      __pyx_t_3 = 0;
      __pyx_v_ch = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "renpy/display/render.pyx":657
 *                 child, x, y, focus, main = self.children[0]
 *                 cw, ch = child.get_size()
 *                 if x <= 0 and y <= 0 and cw + x >= self.width and ch + y >= self.height:             # <<<<<<<<<<<<<<
 *                     # Our single child overlaps us.
 *                     if isinstance(child, Render):
 */
      __pyx_t_10 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (__pyx_t_4) {
        __pyx_t_10 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (__pyx_t_1) {
          __pyx_t_10 = PyNumber_Add(__pyx_v_cw, __pyx_v_x); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_3 = PyObject_RichCompare(__pyx_t_10, __pyx_t_9, Py_GE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
          __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (__pyx_t_5) {
            __pyx_t_3 = PyNumber_Add(__pyx_v_ch, __pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_9 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __pyx_t_10 = PyObject_RichCompare(__pyx_t_3, __pyx_t_9, Py_GE); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_10);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
            __pyx_t_14 = __pyx_t_13;
          } else {
            __pyx_t_14 = __pyx_t_5;
          }
          __pyx_t_5 = __pyx_t_14;
        } else {
          __pyx_t_5 = __pyx_t_1;
        }
        __pyx_t_1 = __pyx_t_5;
      } else {
        __pyx_t_1 = __pyx_t_4;
      }
      if (__pyx_t_1) {

        /* "renpy/display/render.pyx":659
 *                 if x <= 0 and y <= 0 and cw + x >= self.width and ch + y >= self.height:
 *                     # Our single child overlaps us.
 *                     if isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                         child = child.render_to_texture(alpha)
 * 
 */
        __pyx_t_10 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
        __Pyx_INCREF(__pyx_t_10);
        __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_child, __pyx_t_10); 
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (__pyx_t_1) {

          /* "renpy/display/render.pyx":660
 *                     # Our single child overlaps us.
 *                     if isinstance(child, Render):
 *                         child = child.render_to_texture(alpha)             # <<<<<<<<<<<<<<
 * 
 *                     if x != 0 or y != 0 or cw != self.width or ch != self.height:
 */
          __pyx_t_10 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_9));
          __Pyx_INCREF(__pyx_v_alpha);
          PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_alpha);
          __Pyx_GIVEREF(__pyx_v_alpha);
          __pyx_t_3 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_v_child);
          __pyx_v_child = __pyx_t_3;
          __pyx_t_3 = 0;
          goto __pyx_L16;
        }
        __pyx_L16:;

        /* "renpy/display/render.pyx":662
 *                         child = child.render_to_texture(alpha)
 * 
 *                     if x != 0 or y != 0 or cw != self.width or ch != self.height:             # <<<<<<<<<<<<<<
 *                         rv = child.subsurface((-x, -y, self.width, self.height))
 *                     else:
 */
        __pyx_t_3 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!__pyx_t_1) {
          __pyx_t_3 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (!__pyx_t_4) {
            __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_3);
            __pyx_t_9 = PyObject_RichCompare(__pyx_v_cw, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_GOTREF(__pyx_t_9);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
            if (!__pyx_t_5) {
              __pyx_t_9 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_9);
              __pyx_t_3 = PyObject_RichCompare(__pyx_v_ch, __pyx_t_9, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_GOTREF(__pyx_t_3);
              __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
              __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
              __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
              __pyx_t_13 = __pyx_t_14;
            } else {
              __pyx_t_13 = __pyx_t_5;
            }
            __pyx_t_5 = __pyx_t_13;
          } else {
            __pyx_t_5 = __pyx_t_4;
          }
          __pyx_t_4 = __pyx_t_5;
        } else {
          __pyx_t_4 = __pyx_t_1;
        }
        if (__pyx_t_4) {

          /* "renpy/display/render.pyx":663
 * 
 *                     if x != 0 or y != 0 or cw != self.width or ch != self.height:
 *                         rv = child.subsurface((-x, -y, self.width, self.height))             # <<<<<<<<<<<<<<
 *                     else:
 *                         rv = child
 */
          __pyx_t_3 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_9 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_9);
          __pyx_t_10 = PyNumber_Negative(__pyx_v_y); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_10);
          __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_7 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_2));
          PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
          __Pyx_GIVEREF(__pyx_t_9);
          PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_10);
          PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8);
          __Pyx_GIVEREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_7);
          __Pyx_GIVEREF(__pyx_t_7);
          __pyx_t_9 = 0;
          __pyx_t_10 = 0;
          __pyx_t_8 = 0;
          __pyx_t_7 = 0;
          __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_7));
          PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_t_2));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
          __pyx_t_2 = 0;
          __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_v_rv);
          __pyx_v_rv = __pyx_t_2;
          __pyx_t_2 = 0;
          goto __pyx_L17;
        }
        /*else*/ {

          /* "renpy/display/render.pyx":665
 *                         rv = child.subsurface((-x, -y, self.width, self.height))
 *                     else:
 *                         rv = child             # <<<<<<<<<<<<<<
 * 
 *         # Otherwise, render to a texture.
 */
          __Pyx_INCREF(__pyx_v_child);
          __Pyx_DECREF(__pyx_v_rv);
          __pyx_v_rv = __pyx_v_child;
        }
        __pyx_L17:;
        goto __pyx_L15;
      }
      __pyx_L15:;
      goto __pyx_L10;
    }
    __pyx_L10:;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "renpy/display/render.pyx":668
 * 
 *         # Otherwise, render to a texture.
 *         if rv is None:             # <<<<<<<<<<<<<<
 *             # is_opaque has already been called.
 *             rv = renpy.display.draw.render_to_texture(self, alpha)
 */
  __pyx_t_4 = (__pyx_v_rv == Py_None);
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":670
 *         if rv is None:
 *             # is_opaque has already been called.
 *             rv = renpy.display.draw.render_to_texture(self, alpha)             # <<<<<<<<<<<<<<
 * 
 *         # Stash and return the surface.
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __Pyx_INCREF(__pyx_v_alpha);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_alpha);
    __Pyx_GIVEREF(__pyx_v_alpha);
    __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_rv);
    __pyx_v_rv = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L18;
  }
  __pyx_L18:;

  /* "renpy/display/render.pyx":673
 * 
 *         # Stash and return the surface.
 *         if alpha:             # <<<<<<<<<<<<<<
 *             self.alpha_surface = rv
 *         else:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_alpha); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":674
 *         # 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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
    ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface = __pyx_v_rv;
    goto __pyx_L19;
  }
  /*else*/ {

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

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __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_XDECREF(__pyx_v_opaque);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __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":682
 *     pygame_surface = render_to_texture
 * 
 *     def subsurface(self, rect, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a subsurface of this render. If `focus` is true, then
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8subsurface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_8subsurface[] = "\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_pf_5renpy_7display_6render_6Render_8subsurface(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_focus = 0;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_h = NULL;
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rv = NULL;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse = NULL;
  PyObject *__pyx_v_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_cw = NULL;
  PyObject *__pyx_v_ch = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  PyObject *__pyx_v_crop = NULL;
  PyObject *__pyx_v_offset = 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;
  int __pyx_t_11;
  int __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__rect,&__pyx_n_s__focus,0};
  __Pyx_RefNannySetupContext("subsurface");
  {
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_14;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rect);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__focus);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "subsurface") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":688
 *         """
 * 
 *         (x, y, w, h) = rect             # <<<<<<<<<<<<<<
 *         rv = Render(w, h)
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_rect))) || (PyList_CheckExact(__pyx_v_rect))) {
    PyObject* sequence = __pyx_v_rect;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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 {
      if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
        if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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 index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_v_rect); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 2; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 3; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L7_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":689
 * 
 *         (x, y, w, h) = rect
 *         rv = Render(w, h)             # <<<<<<<<<<<<<<
 * 
 *         reverse = self.reverse
 */
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render)), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__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":691
 *         rv = Render(w, h)
 * 
 *         reverse = self.reverse             # <<<<<<<<<<<<<<
 * 
 *         # This doesn't actually make a subsurface, as we can't easily do
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse));
  __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse;

  /* "renpy/display/render.pyx":695
 *         # This doesn't actually make a subsurface, as we can't easily do
 *         # so for non-rectangle-aligned renders.
 *         if (reverse is not None) and (             # <<<<<<<<<<<<<<
 *             reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 */
  __pyx_t_7 = (((PyObject *)__pyx_v_reverse) != Py_None);
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":696
 *         # so for non-rectangle-aligned renders.
 *         if (reverse is not None) and (
 *             reverse.xdx != 1.0 or             # <<<<<<<<<<<<<<
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or
 */
    __pyx_t_8 = (__pyx_v_reverse->xdx != 1.0);
    if (!__pyx_t_8) {

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

        /* "renpy/display/render.pyx":698
 *             reverse.xdx != 1.0 or
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or             # <<<<<<<<<<<<<<
 *             reverse.ydy != 1.0):
 * 
 */
        __pyx_t_10 = (__pyx_v_reverse->ydx != 0.0);
        if (!__pyx_t_10) {

          /* "renpy/display/render.pyx":699
 *             reverse.xdy != 0.0 or
 *             reverse.ydx != 0.0 or
 *             reverse.ydy != 1.0):             # <<<<<<<<<<<<<<
 * 
 *             rv.clipping = True
 */
          __pyx_t_11 = (__pyx_v_reverse->ydy != 1.0);
          __pyx_t_12 = __pyx_t_11;
        } else {
          __pyx_t_12 = __pyx_t_10;
        }
        __pyx_t_10 = __pyx_t_12;
      } else {
        __pyx_t_10 = __pyx_t_9;
      }
      __pyx_t_9 = __pyx_t_10;
    } else {
      __pyx_t_9 = __pyx_t_8;
    }
    __pyx_t_8 = __pyx_t_9;
  } else {
    __pyx_t_8 = __pyx_t_7;
  }
  if (__pyx_t_8) {

    /* "renpy/display/render.pyx":701
 *             reverse.ydy != 1.0):
 * 
 *             rv.clipping = True             # <<<<<<<<<<<<<<
 *             rv.blit(self, (-x, -y), focus=focus, main=True)
 *             return rv
 */
    __pyx_v_rv->clipping = 1;

    /* "renpy/display/render.pyx":702
 * 
 *             rv.clipping = True
 *             rv.blit(self, (-x, -y), focus=focus, main=True)             # <<<<<<<<<<<<<<
 *             return rv
 * 
 */
    __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_rv), __pyx_n_s__blit); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Negative(__pyx_v_x); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Negative(__pyx_v_y); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__focus), __pyx_v_focus) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__main), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":703
 *             rv.clipping = True
 *             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;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "renpy/display/render.pyx":708
 *         # making an actual subsurface.
 * 
 *         for child, cx, cy, cfocus, cmain in self.children:             # <<<<<<<<<<<<<<
 * 
 *             cw, ch = child.get_size()
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children); __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0;
  for (;;) {
    if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break;
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
          if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
          if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_16 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_16)->tp_iternext;
      index = 0; __pyx_t_2 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_2)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 2; __pyx_t_5 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 3; __pyx_t_14 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 4; __pyx_t_15 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_16), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __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;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L12_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_v_cx);
    __pyx_v_cx = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_cy);
    __pyx_v_cy = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_cfocus);
    __pyx_v_cfocus = __pyx_t_14;
    __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_v_cmain);
    __pyx_v_cmain = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "renpy/display/render.pyx":710
 *         for child, cx, cy, cfocus, cmain in self.children:
 * 
 *             cw, ch = child.get_size()             # <<<<<<<<<<<<<<
 *             xo, cx, cw = compute_subline(cx, cw, x, w)
 *             yo, cy, ch = compute_subline(cy, ch, y, h)
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
      PyObject* sequence = __pyx_t_15;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L13_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_14 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_14)) goto __pyx_L13_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_unpacking_done;
      __pyx_L13_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L14_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_cw);
    __pyx_v_cw = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_v_ch);
    __pyx_v_ch = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "renpy/display/render.pyx":711
 * 
 *             cw, ch = child.get_size()
 *             xo, cx, cw = compute_subline(cx, cw, x, w)             # <<<<<<<<<<<<<<
 *             yo, cy, ch = compute_subline(cy, ch, y, h)
 * 
 */
    __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__compute_subline); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    __Pyx_INCREF(__pyx_v_cx);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_cx);
    __Pyx_GIVEREF(__pyx_v_cx);
    __Pyx_INCREF(__pyx_v_cw);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_cw);
    __Pyx_GIVEREF(__pyx_v_cw);
    __Pyx_INCREF(__pyx_v_x);
    PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_x);
    __Pyx_GIVEREF(__pyx_v_x);
    __Pyx_INCREF(__pyx_v_w);
    PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_v_w);
    __Pyx_GIVEREF(__pyx_v_w);
    __pyx_t_1 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
          if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
          if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_14 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_14 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_14)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 1; __pyx_t_15 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_15)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 2; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L16_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_xo);
    __pyx_v_xo = __pyx_t_14;
    __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_v_cx);
    __pyx_v_cx = __pyx_t_15;
    __pyx_t_15 = 0;
    __Pyx_DECREF(__pyx_v_cw);
    __pyx_v_cw = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/display/render.pyx":712
 *             cw, ch = child.get_size()
 *             xo, cx, cw = compute_subline(cx, cw, x, w)
 *             yo, cy, ch = compute_subline(cy, ch, y, h)             # <<<<<<<<<<<<<<
 * 
 *             if cw <= 0 or ch <= 0:
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__compute_subline); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_cy);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_cy);
    __Pyx_GIVEREF(__pyx_v_cy);
    __Pyx_INCREF(__pyx_v_ch);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_ch);
    __Pyx_GIVEREF(__pyx_v_ch);
    __Pyx_INCREF(__pyx_v_y);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_y);
    __Pyx_GIVEREF(__pyx_v_y);
    __Pyx_INCREF(__pyx_v_h);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_h);
    __Pyx_GIVEREF(__pyx_v_h);
    __pyx_t_15 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
      PyObject* sequence = __pyx_t_15;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
          if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
          if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = 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_5);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_3 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_6 = Py_TYPE(__pyx_t_3)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_1 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 2; __pyx_t_14 = __pyx_t_6(__pyx_t_3); if (unlikely(!__pyx_t_14)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_3), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L18_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_yo);
    __pyx_v_yo = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_cy);
    __pyx_v_cy = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_ch);
    __pyx_v_ch = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "renpy/display/render.pyx":714
 *             yo, cy, ch = compute_subline(cy, ch, y, h)
 * 
 *             if cw <= 0 or ch <= 0:             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_15 = PyObject_RichCompare(__pyx_v_cw, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (!__pyx_t_8) {
      __pyx_t_15 = PyObject_RichCompare(__pyx_v_ch, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_15); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_9 = __pyx_t_7;
    } else {
      __pyx_t_9 = __pyx_t_8;
    }
    if (__pyx_t_9) {

      /* "renpy/display/render.pyx":715
 * 
 *             if cw <= 0 or ch <= 0:
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             crop = (cx, cy, cw, ch)
 */
      goto __pyx_L9_continue;
      goto __pyx_L19;
    }
    __pyx_L19:;

    /* "renpy/display/render.pyx":717
 *                 continue
 * 
 *             crop = (cx, cy, cw, ch)             # <<<<<<<<<<<<<<
 *             offset = (xo, yo)
 * 
 */
    __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_15));
    __Pyx_INCREF(__pyx_v_cx);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_cx);
    __Pyx_GIVEREF(__pyx_v_cx);
    __Pyx_INCREF(__pyx_v_cy);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_cy);
    __Pyx_GIVEREF(__pyx_v_cy);
    __Pyx_INCREF(__pyx_v_cw);
    PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_cw);
    __Pyx_GIVEREF(__pyx_v_cw);
    __Pyx_INCREF(__pyx_v_ch);
    PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_ch);
    __Pyx_GIVEREF(__pyx_v_ch);
    __Pyx_XDECREF(((PyObject *)__pyx_v_crop));
    __pyx_v_crop = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "renpy/display/render.pyx":718
 * 
 *             crop = (cx, cy, cw, ch)
 *             offset = (xo, yo)             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(child, Render):
 */
    __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_15));
    __Pyx_INCREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    __Pyx_XDECREF(((PyObject *)__pyx_v_offset));
    __pyx_v_offset = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "renpy/display/render.pyx":720
 *             offset = (xo, yo)
 * 
 *             if isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 newchild = child.subsurface(crop, focus=focus)
 *                 newchild.render_of = child.render_of[:]
 */
    __pyx_t_15 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
    __Pyx_INCREF(__pyx_t_15);
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_child, __pyx_t_15); 
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    if (__pyx_t_9) {

      /* "renpy/display/render.pyx":721
 * 
 *             if isinstance(child, Render):
 *                 newchild = child.subsurface(crop, focus=focus)             # <<<<<<<<<<<<<<
 *                 newchild.render_of = child.render_of[:]
 *             else:
 */
      __pyx_t_15 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
      __Pyx_INCREF(((PyObject *)__pyx_v_crop));
      PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_v_crop));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_crop));
      __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__focus), __pyx_v_focus) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_15, ((PyObject *)__pyx_t_14), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_v_newchild);
      __pyx_v_newchild = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "renpy/display/render.pyx":722
 *             if isinstance(child, Render):
 *                 newchild = child.subsurface(crop, focus=focus)
 *                 newchild.render_of = child.render_of[:]             # <<<<<<<<<<<<<<
 *             else:
 *                 newchild = child.subsurface(crop)
 */
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__render_of); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PySequence_GetSlice(__pyx_t_5, 0, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyObject_SetAttr(__pyx_v_newchild, __pyx_n_s__render_of, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L20;
    }
    /*else*/ {

      /* "renpy/display/render.pyx":724
 *                 newchild.render_of = child.render_of[:]
 *             else:
 *                 newchild = child.subsurface(crop)             # <<<<<<<<<<<<<<
 *                 renpy.display.draw.mutated_surface(newchild)
 * 
 */
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(((PyObject *)__pyx_v_crop));
      PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_crop));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_crop));
      __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_v_newchild);
      __pyx_v_newchild = __pyx_t_14;
      __pyx_t_14 = 0;

      /* "renpy/display/render.pyx":725
 *             else:
 *                 newchild = child.subsurface(crop)
 *                 renpy.display.draw.mutated_surface(newchild)             # <<<<<<<<<<<<<<
 * 
 *             rv.blit(newchild, offset, focus=cfocus, main=cmain)
 */
      __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__draw); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_14, __pyx_n_s__mutated_surface); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
      __Pyx_INCREF(__pyx_v_newchild);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_newchild);
      __Pyx_GIVEREF(__pyx_v_newchild);
      __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L20:;

    /* "renpy/display/render.pyx":727
 *                 renpy.display.draw.mutated_surface(newchild)
 * 
 *             rv.blit(newchild, offset, focus=cfocus, main=cmain)             # <<<<<<<<<<<<<<
 * 
 *         if focus and self.focuses:
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rv), __pyx_n_s__blit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    __Pyx_INCREF(__pyx_v_newchild);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_newchild);
    __Pyx_GIVEREF(__pyx_v_newchild);
    __Pyx_INCREF(((PyObject *)__pyx_v_offset));
    PyTuple_SET_ITEM(__pyx_t_14, 1, ((PyObject *)__pyx_v_offset));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_offset));
    __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__focus), __pyx_v_cfocus) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__main), __pyx_v_cmain) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_15 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_14), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __pyx_L9_continue:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":729
 *             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_9 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_9) {
    __pyx_t_8 = (((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses) != Py_None) && (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses)) != 0);
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_t_9;
  }
  if (__pyx_t_7) {

    /* "renpy/display/render.pyx":731
 *         if focus and self.focuses:
 * 
 *             for (d, arg, xo, yo, fw, fh, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
    if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_4 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses); __Pyx_INCREF(__pyx_t_4); __pyx_t_13 = 0;
    for (;;) {
      if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_15 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_13); __Pyx_INCREF(__pyx_t_15); __pyx_t_13++;
      if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
        PyObject* sequence = __pyx_t_15;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 9)) {
            if (PyTuple_GET_SIZE(sequence) > 9) __Pyx_RaiseTooManyValuesError(9);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_1 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_2 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_16 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_17 = PyTuple_GET_ITEM(sequence, 6); 
          __pyx_t_18 = PyTuple_GET_ITEM(sequence, 7); 
          __pyx_t_19 = PyTuple_GET_ITEM(sequence, 8); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 9)) {
            if (PyList_GET_SIZE(sequence) > 9) __Pyx_RaiseTooManyValuesError(9);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_1 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_3 = PyList_GET_ITEM(sequence, 3); 
          __pyx_t_2 = PyList_GET_ITEM(sequence, 4); 
          __pyx_t_16 = PyList_GET_ITEM(sequence, 5); 
          __pyx_t_17 = PyList_GET_ITEM(sequence, 6); 
          __pyx_t_18 = PyList_GET_ITEM(sequence, 7); 
          __pyx_t_19 = PyList_GET_ITEM(sequence, 8); 
        }
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_18);
        __Pyx_INCREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_20 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_20);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_20)->tp_iternext;
        index = 0; __pyx_t_5 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_5)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_14 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_14)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_14);
        index = 2; __pyx_t_1 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_1)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_1);
        index = 3; __pyx_t_3 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_3)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 4; __pyx_t_2 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_2)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_2);
        index = 5; __pyx_t_16 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_16)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_16);
        index = 6; __pyx_t_17 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_17)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_17);
        index = 7; __pyx_t_18 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_18)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_18);
        index = 8; __pyx_t_19 = __pyx_t_6(__pyx_t_20); if (unlikely(!__pyx_t_19)) goto __pyx_L24_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_19);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_20), 9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        goto __pyx_L25_unpacking_done;
        __pyx_L24_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L25_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_d);
      __pyx_v_d = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_v_arg);
      __pyx_v_arg = __pyx_t_14;
      __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_v_xo);
      __pyx_v_xo = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_v_yo);
      __pyx_v_yo = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_v_fw);
      __pyx_v_fw = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_v_fh);
      __pyx_v_fh = __pyx_t_16;
      __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_v_mx);
      __pyx_v_mx = __pyx_t_17;
      __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_v_my);
      __pyx_v_my = __pyx_t_18;
      __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_v_mask);
      __pyx_v_mask = __pyx_t_19;
      __pyx_t_19 = 0;

      /* "renpy/display/render.pyx":733
 *             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_7 = (__pyx_v_xo == Py_None);
      if (__pyx_t_7) {

        /* "renpy/display/render.pyx":734
 * 
 *                 if xo is None:
 *                     rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_rv), __pyx_n_s__add_focus); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_15);
        __pyx_t_19 = PyTuple_New(9); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_19));
        __Pyx_INCREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        __Pyx_INCREF(__pyx_v_arg);
        PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_arg);
        __Pyx_GIVEREF(__pyx_v_arg);
        __Pyx_INCREF(__pyx_v_xo);
        PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_v_xo);
        __Pyx_GIVEREF(__pyx_v_xo);
        __Pyx_INCREF(__pyx_v_yo);
        PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_v_yo);
        __Pyx_GIVEREF(__pyx_v_yo);
        __Pyx_INCREF(__pyx_v_fw);
        PyTuple_SET_ITEM(__pyx_t_19, 4, __pyx_v_fw);
        __Pyx_GIVEREF(__pyx_v_fw);
        __Pyx_INCREF(__pyx_v_fh);
        PyTuple_SET_ITEM(__pyx_t_19, 5, __pyx_v_fh);
        __Pyx_GIVEREF(__pyx_v_fh);
        __Pyx_INCREF(__pyx_v_mx);
        PyTuple_SET_ITEM(__pyx_t_19, 6, __pyx_v_mx);
        __Pyx_GIVEREF(__pyx_v_mx);
        __Pyx_INCREF(__pyx_v_my);
        PyTuple_SET_ITEM(__pyx_t_19, 7, __pyx_v_my);
        __Pyx_GIVEREF(__pyx_v_my);
        __Pyx_INCREF(__pyx_v_mask);
        PyTuple_SET_ITEM(__pyx_t_19, 8, __pyx_v_mask);
        __Pyx_GIVEREF(__pyx_v_mask);
        __pyx_t_18 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

        /* "renpy/display/render.pyx":735
 *                 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_L22_continue;
        goto __pyx_L26;
      }
      __pyx_L26:;

      /* "renpy/display/render.pyx":737
 *                     continue
 * 
 *                 xo, cx, fw = compute_subline(xo, fw, x, w)             # <<<<<<<<<<<<<<
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)
 * 
 */
      __pyx_t_18 = __Pyx_GetName(__pyx_m, __pyx_n_s__compute_subline); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_19 = PyTuple_New(4); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_19));
      __Pyx_INCREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      __Pyx_INCREF(__pyx_v_fw);
      PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_v_fw);
      __Pyx_GIVEREF(__pyx_v_fw);
      __Pyx_INCREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      __Pyx_INCREF(__pyx_v_w);
      PyTuple_SET_ITEM(__pyx_t_19, 3, __pyx_v_w);
      __Pyx_GIVEREF(__pyx_v_w);
      __pyx_t_15 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_15))) || (PyList_CheckExact(__pyx_t_15))) {
        PyObject* sequence = __pyx_t_15;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
            if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_19 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_17 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
            if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_19 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_18 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_17 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_19);
        __Pyx_INCREF(__pyx_t_18);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_16 = PyObject_GetIter(__pyx_t_15); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_16)->tp_iternext;
        index = 0; __pyx_t_19 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_19)) goto __pyx_L27_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_19);
        index = 1; __pyx_t_18 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_18)) goto __pyx_L27_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_18);
        index = 2; __pyx_t_17 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_17)) goto __pyx_L27_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_17);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_16), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        goto __pyx_L28_unpacking_done;
        __pyx_L27_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L28_unpacking_done:;
      }
      __Pyx_DECREF(__pyx_v_xo);
      __pyx_v_xo = __pyx_t_19;
      __pyx_t_19 = 0;
      __Pyx_XDECREF(__pyx_v_cx);
      __pyx_v_cx = __pyx_t_18;
      __pyx_t_18 = 0;
      __Pyx_DECREF(__pyx_v_fw);
      __pyx_v_fw = __pyx_t_17;
      __pyx_t_17 = 0;

      /* "renpy/display/render.pyx":738
 * 
 *                 xo, cx, fw = compute_subline(xo, fw, x, w)
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)             # <<<<<<<<<<<<<<
 * 
 *                 if cw <= 0 or ch <= 0:
 */
      __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__compute_subline); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_17 = PyTuple_New(4); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_17));
      __Pyx_INCREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      __Pyx_INCREF(__pyx_v_fh);
      PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_fh);
      __Pyx_GIVEREF(__pyx_v_fh);
      __Pyx_INCREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      __Pyx_INCREF(__pyx_v_h);
      PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_v_h);
      __Pyx_GIVEREF(__pyx_v_h);
      __pyx_t_18 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_18);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_18))) || (PyList_CheckExact(__pyx_t_18))) {
        PyObject* sequence = __pyx_t_18;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
            if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_19 = PyTuple_GET_ITEM(sequence, 2); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
            if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_17 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_19 = PyList_GET_ITEM(sequence, 2); 
        }
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_16 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_16);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __pyx_t_6 = Py_TYPE(__pyx_t_16)->tp_iternext;
        index = 0; __pyx_t_17 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_17)) goto __pyx_L29_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_17);
        index = 1; __pyx_t_15 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L29_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_15);
        index = 2; __pyx_t_19 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_19)) goto __pyx_L29_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_19);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_16), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        goto __pyx_L30_unpacking_done;
        __pyx_L29_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L30_unpacking_done:;
      }
      __Pyx_DECREF(__pyx_v_yo);
      __pyx_v_yo = __pyx_t_17;
      __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_v_cy);
      __pyx_v_cy = __pyx_t_15;
      __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_v_fh);
      __pyx_v_fh = __pyx_t_19;
      __pyx_t_19 = 0;
      if (unlikely(!__pyx_v_cw)) { __Pyx_RaiseUnboundLocalError("cw"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_18 = PyObject_RichCompare(__pyx_v_cw, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/display/render.pyx":740
 *                 yo, cy, fh = compute_subline(yo, fh, y, h)
 * 
 *                 if cw <= 0 or ch <= 0:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __Pyx_GOTREF(__pyx_t_18);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
      if (!__pyx_t_7) {
        if (unlikely(!__pyx_v_ch)) { __Pyx_RaiseUnboundLocalError("ch"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_18 = PyObject_RichCompare(__pyx_v_ch, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __pyx_t_8 = __pyx_t_9;
      } else {
        __pyx_t_8 = __pyx_t_7;
      }
      if (__pyx_t_8) {

        /* "renpy/display/render.pyx":741
 * 
 *                 if cw <= 0 or ch <= 0:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 if mx is not None:
 */
        goto __pyx_L22_continue;
        goto __pyx_L31;
      }
      __pyx_L31:;

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

        /* "renpy/display/render.pyx":745
 *                 if mx is not None:
 * 
 *                     mw, mh = mask.get_size()             # <<<<<<<<<<<<<<
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)
 */
        __pyx_t_18 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__get_size); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __pyx_t_19 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_19))) || (PyList_CheckExact(__pyx_t_19))) {
          PyObject* sequence = __pyx_t_19;
          if (likely(PyTuple_CheckExact(sequence))) {
            if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
              if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
              else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_18 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_15 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
              if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
              else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_18 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_15 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_18);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_17 = PyObject_GetIter(__pyx_t_19); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_17)->tp_iternext;
          index = 0; __pyx_t_18 = __pyx_t_6(__pyx_t_17); if (unlikely(!__pyx_t_18)) goto __pyx_L33_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_18);
          index = 1; __pyx_t_15 = __pyx_t_6(__pyx_t_17); if (unlikely(!__pyx_t_15)) goto __pyx_L33_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_15);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_17), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          goto __pyx_L34_unpacking_done;
          __pyx_L33_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
          if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
          if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L34_unpacking_done:;
        }
        __Pyx_XDECREF(__pyx_v_mw);
        __pyx_v_mw = __pyx_t_18;
        __pyx_t_18 = 0;
        __Pyx_XDECREF(__pyx_v_mh);
        __pyx_v_mh = __pyx_t_15;
        __pyx_t_15 = 0;

        /* "renpy/display/render.pyx":747
 *                     mw, mh = mask.get_size()
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)             # <<<<<<<<<<<<<<
 *                     my, mcy, mh = compute_subline(my, mh, y, h)
 * 
 */
        __pyx_t_19 = __Pyx_GetName(__pyx_m, __pyx_n_s__compute_subline); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_19);
        __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_15));
        __Pyx_INCREF(__pyx_v_mx);
        PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_mx);
        __Pyx_GIVEREF(__pyx_v_mx);
        __Pyx_INCREF(__pyx_v_mw);
        PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_mw);
        __Pyx_GIVEREF(__pyx_v_mw);
        __Pyx_INCREF(__pyx_v_x);
        PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_x);
        __Pyx_GIVEREF(__pyx_v_x);
        __Pyx_INCREF(__pyx_v_w);
        PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_w);
        __Pyx_GIVEREF(__pyx_v_w);
        __pyx_t_18 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_18))) || (PyList_CheckExact(__pyx_t_18))) {
          PyObject* sequence = __pyx_t_18;
          if (likely(PyTuple_CheckExact(sequence))) {
            if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
              if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
              else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_19 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_17 = PyTuple_GET_ITEM(sequence, 2); 
          } else {
            if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
              if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
              else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_15 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_19 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_17 = PyList_GET_ITEM(sequence, 2); 
          }
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_19);
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_16 = PyObject_GetIter(__pyx_t_18); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_16)->tp_iternext;
          index = 0; __pyx_t_15 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L35_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_15);
          index = 1; __pyx_t_19 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_19)) goto __pyx_L35_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_19);
          index = 2; __pyx_t_17 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_17)) goto __pyx_L35_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_17);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_16), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          goto __pyx_L36_unpacking_done;
          __pyx_L35_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
          if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L36_unpacking_done:;
        }
        __Pyx_DECREF(__pyx_v_mx);
        __pyx_v_mx = __pyx_t_15;
        __pyx_t_15 = 0;
        __Pyx_XDECREF(__pyx_v_mcx);
        __pyx_v_mcx = __pyx_t_19;
        __pyx_t_19 = 0;
        __Pyx_DECREF(__pyx_v_mw);
        __pyx_v_mw = __pyx_t_17;
        __pyx_t_17 = 0;

        /* "renpy/display/render.pyx":748
 * 
 *                     mx, mcx, mw = compute_subline(mx, mw, x, w)
 *                     my, mcy, mh = compute_subline(my, mh, y, h)             # <<<<<<<<<<<<<<
 * 
 *                     if mw <= 0 or mh <= 0:
 */
        __pyx_t_18 = __Pyx_GetName(__pyx_m, __pyx_n_s__compute_subline); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __pyx_t_17 = PyTuple_New(4); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_17));
        __Pyx_INCREF(__pyx_v_my);
        PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_my);
        __Pyx_GIVEREF(__pyx_v_my);
        __Pyx_INCREF(__pyx_v_mh);
        PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_mh);
        __Pyx_GIVEREF(__pyx_v_mh);
        __Pyx_INCREF(__pyx_v_y);
        PyTuple_SET_ITEM(__pyx_t_17, 2, __pyx_v_y);
        __Pyx_GIVEREF(__pyx_v_y);
        __Pyx_INCREF(__pyx_v_h);
        PyTuple_SET_ITEM(__pyx_t_17, 3, __pyx_v_h);
        __Pyx_GIVEREF(__pyx_v_h);
        __pyx_t_19 = PyObject_Call(__pyx_t_18, ((PyObject *)__pyx_t_17), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_19);
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_17)); __pyx_t_17 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_19))) || (PyList_CheckExact(__pyx_t_19))) {
          PyObject* sequence = __pyx_t_19;
          if (likely(PyTuple_CheckExact(sequence))) {
            if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
              if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
              else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1); 
            __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); 
          } else {
            if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
              if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
              else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_17 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_18 = PyList_GET_ITEM(sequence, 1); 
            __pyx_t_15 = PyList_GET_ITEM(sequence, 2); 
          }
          __Pyx_INCREF(__pyx_t_17);
          __Pyx_INCREF(__pyx_t_18);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_16 = PyObject_GetIter(__pyx_t_19); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_16);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_6 = Py_TYPE(__pyx_t_16)->tp_iternext;
          index = 0; __pyx_t_17 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_17)) goto __pyx_L37_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_17);
          index = 1; __pyx_t_18 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_18)) goto __pyx_L37_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_18);
          index = 2; __pyx_t_15 = __pyx_t_6(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L37_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_15);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_16), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          goto __pyx_L38_unpacking_done;
          __pyx_L37_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
          if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
          if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_L38_unpacking_done:;
        }
        __Pyx_DECREF(__pyx_v_my);
        __pyx_v_my = __pyx_t_17;
        __pyx_t_17 = 0;
        __Pyx_XDECREF(__pyx_v_mcy);
        __pyx_v_mcy = __pyx_t_18;
        __pyx_t_18 = 0;
        __Pyx_DECREF(__pyx_v_mh);
        __pyx_v_mh = __pyx_t_15;
        __pyx_t_15 = 0;

        /* "renpy/display/render.pyx":750
 *                     my, mcy, mh = compute_subline(my, mh, y, h)
 * 
 *                     if mw <= 0 or mh <= 0:             # <<<<<<<<<<<<<<
 *                         mx = None
 *                         my = None
 */
        __pyx_t_19 = PyObject_RichCompare(__pyx_v_mw, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_19);
        __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_19); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
        if (!__pyx_t_8) {
          __pyx_t_19 = PyObject_RichCompare(__pyx_v_mh, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_19);
          __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_19); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 750; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __pyx_t_9 = __pyx_t_7;
        } else {
          __pyx_t_9 = __pyx_t_8;
        }
        if (__pyx_t_9) {

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

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

          /* "renpy/display/render.pyx":753
 *                         mx = None
 *                         my = None
 *                         mask = None             # <<<<<<<<<<<<<<
 *                     else:
 *                         mask = mask.subsurface((mcx, mcy, mw, mh))
 */
          __Pyx_INCREF(Py_None);
          __Pyx_DECREF(__pyx_v_mask);
          __pyx_v_mask = Py_None;
          goto __pyx_L39;
        }
        /*else*/ {

          /* "renpy/display/render.pyx":755
 *                         mask = None
 *                     else:
 *                         mask = mask.subsurface((mcx, mcy, mw, mh))             # <<<<<<<<<<<<<<
 * 
 *                 rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 */
          __pyx_t_19 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_19);
          __pyx_t_15 = PyTuple_New(4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_15));
          __Pyx_INCREF(__pyx_v_mcx);
          PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_v_mcx);
          __Pyx_GIVEREF(__pyx_v_mcx);
          __Pyx_INCREF(__pyx_v_mcy);
          PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_v_mcy);
          __Pyx_GIVEREF(__pyx_v_mcy);
          __Pyx_INCREF(__pyx_v_mw);
          PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_v_mw);
          __Pyx_GIVEREF(__pyx_v_mw);
          __Pyx_INCREF(__pyx_v_mh);
          PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_v_mh);
          __Pyx_GIVEREF(__pyx_v_mh);
          __pyx_t_18 = PyTuple_New(1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_18));
          PyTuple_SET_ITEM(__pyx_t_18, 0, ((PyObject *)__pyx_t_15));
          __Pyx_GIVEREF(((PyObject *)__pyx_t_15));
          __pyx_t_15 = 0;
          __pyx_t_15 = PyObject_Call(__pyx_t_19, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_15);
          __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
          __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
          __Pyx_DECREF(__pyx_v_mask);
          __pyx_v_mask = __pyx_t_15;
          __pyx_t_15 = 0;
        }
        __pyx_L39:;
        goto __pyx_L32;
      }
      __pyx_L32:;

      /* "renpy/display/render.pyx":757
 *                         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_15 = PyObject_GetAttr(((PyObject *)__pyx_v_rv), __pyx_n_s__add_focus); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __pyx_t_18 = PyTuple_New(9); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_18));
      __Pyx_INCREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      __Pyx_INCREF(__pyx_v_arg);
      PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_v_arg);
      __Pyx_GIVEREF(__pyx_v_arg);
      __Pyx_INCREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_v_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      __Pyx_INCREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_18, 3, __pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      __Pyx_INCREF(__pyx_v_fw);
      PyTuple_SET_ITEM(__pyx_t_18, 4, __pyx_v_fw);
      __Pyx_GIVEREF(__pyx_v_fw);
      __Pyx_INCREF(__pyx_v_fh);
      PyTuple_SET_ITEM(__pyx_t_18, 5, __pyx_v_fh);
      __Pyx_GIVEREF(__pyx_v_fh);
      __Pyx_INCREF(__pyx_v_mx);
      PyTuple_SET_ITEM(__pyx_t_18, 6, __pyx_v_mx);
      __Pyx_GIVEREF(__pyx_v_mx);
      __Pyx_INCREF(__pyx_v_my);
      PyTuple_SET_ITEM(__pyx_t_18, 7, __pyx_v_my);
      __Pyx_GIVEREF(__pyx_v_my);
      __Pyx_INCREF(__pyx_v_mask);
      PyTuple_SET_ITEM(__pyx_t_18, 8, __pyx_v_mask);
      __Pyx_GIVEREF(__pyx_v_mask);
      __pyx_t_19 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_18), NULL); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_19);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_18)); __pyx_t_18 = 0;
      __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
      __pyx_L22_continue:;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L21;
  }
  __pyx_L21:;

  /* "renpy/display/render.pyx":759
 *                 rv.add_focus(d, arg, xo, yo, fw, fh, mx, my, mask)
 * 
 *         rv.depends_on(self)             # <<<<<<<<<<<<<<
 *         rv.alpha = self.alpha
 *         rv.operation = self.operation
 */
  __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_rv), __pyx_n_s__depends_on); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_19));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_18 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_19), NULL); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_18);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0;
  __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;

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

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

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

  /* "renpy/display/render.pyx":763
 *         rv.operation = self.operation
 *         rv.operation_alpha = self.operation_alpha
 *         rv.operation_complete = self.operation_complete             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_v_rv->operation_complete = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_complete;

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

  __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_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __Pyx_XDECREF(__pyx_t_19);
  __Pyx_XDECREF(__pyx_t_20);
  __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_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_cw);
  __Pyx_XDECREF(__pyx_v_ch);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_crop);
  __Pyx_XDECREF(__pyx_v_offset);
  __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":768
 * 
 * 
 *     def depends_on(self, source, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Used to indicate that this render depends on another
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9depends_on(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_9depends_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_pf_5renpy_7display_6render_6Render_9depends_on(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_source = 0;
  PyObject *__pyx_v_focus = 0;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__source,&__pyx_n_s__focus,0};
  __Pyx_RefNannySetupContext("depends_on");
  {
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_15;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__source);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__focus);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "depends_on") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __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:;

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

    /* "renpy/display/render.pyx":776
 * 
 *         if source is self:
 *             raise Exception("Render depends on itself.")             # <<<<<<<<<<<<<<
 * 
 *         self.depends_on_list.append(source)
 */
    __pyx_t_2 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":778
 *             raise Exception("Render depends on itself.")
 * 
 *         self.depends_on_list.append(source)             # <<<<<<<<<<<<<<
 *         source.parents.add(self)
 * 
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = PyList_Append(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list, __pyx_v_source); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":779
 * 
 *         self.depends_on_list.append(source)
 *         source.parents.add(self)             # <<<<<<<<<<<<<<
 * 
 *         if focus:
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_source, __pyx_n_s__parents); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__add); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/display/render.pyx":781
 *         source.parents.add(self)
 * 
 *         if focus:             # <<<<<<<<<<<<<<
 *             if self.pass_focuses is None:
 *                 self.pass_focuses = [ source ]
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

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

      /* "renpy/display/render.pyx":783
 *         if focus:
 *             if self.pass_focuses is None:
 *                 self.pass_focuses = [ source ]             # <<<<<<<<<<<<<<
 *             else:
 *                 self.pass_focuses.append(source)
 */
      __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_INCREF(__pyx_v_source);
      PyList_SET_ITEM(__pyx_t_5, 0, __pyx_v_source);
      __Pyx_GIVEREF(__pyx_v_source);
      __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
      __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses));
      ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "renpy/display/render.pyx":785
 *                 self.pass_focuses = [ source ]
 *             else:
 *                 self.pass_focuses.append(source)             # <<<<<<<<<<<<<<
 * 
 * 
 */
      if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_3 = PyList_Append(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses, __pyx_v_source); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_L8:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_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":788
 * 
 * 
 *     def kill_cache(self):             # <<<<<<<<<<<<<<
 *         """
 *         Removes this render and its transitive parents from the cache.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10kill_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_10kill_cache[] = "\n        Removes this render and its transitive parents from the cache.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10kill_cache(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_ro = NULL;
  PyObject *__pyx_v_cache = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *(*__pyx_t_2)(PyObject *);
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *(*__pyx_t_14)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("kill_cache");

  /* "renpy/display/render.pyx":793
 *         """
 * 
 *         if self.cache_killed:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  if (((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->cache_killed) {

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

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

  /* "renpy/display/render.pyx":798
 *         self.cache_killed = True
 * 
 *         for i in self.parents:             # <<<<<<<<<<<<<<
 *             i.kill_cache()
 * 
 */
  __pyx_t_1 = PyObject_GetIter(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = Py_TYPE(__pyx_t_1)->tp_iternext;
  for (;;) {
    {
      __pyx_t_3 = __pyx_t_2(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "renpy/display/render.pyx":799
 * 
 *         for i in self.parents:
 *             i.kill_cache()             # <<<<<<<<<<<<<<
 * 
 *         self.parents.clear()
 */
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_i, __pyx_n_s__kill_cache); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":801
 *             i.kill_cache()
 * 
 *         self.parents.clear()             # <<<<<<<<<<<<<<
 * 
 *         for i in self.depends_on_list:
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents) == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "clear"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_5 = PySet_Clear(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":803
 *         self.parents.clear()
 * 
 *         for i in self.depends_on_list:             # <<<<<<<<<<<<<<
 *             if not i.cache_killed:
 *                 i.parents.discard(self)
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list); __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++;
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":804
 * 
 *         for i in self.depends_on_list:
 *             if not i.cache_killed:             # <<<<<<<<<<<<<<
 *                 i.parents.discard(self)
 * 
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_i, __pyx_n_s__cache_killed); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = (!__pyx_t_7);
    if (__pyx_t_8) {

      /* "renpy/display/render.pyx":805
 *         for i in self.depends_on_list:
 *             if not i.cache_killed:
 *                 i.parents.discard(self)             # <<<<<<<<<<<<<<
 * 
 *         for ro in self.render_of:
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_i, __pyx_n_s__parents); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__discard); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_self);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
      __Pyx_GIVEREF(__pyx_v_self);
      __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":807
 *                 i.parents.discard(self)
 * 
 *         for ro in self.render_of:             # <<<<<<<<<<<<<<
 *             cache = render_cache[ro]
 *             for k, v in cache.items():
 */
  if (PyList_CheckExact(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of) || PyTuple_CheckExact(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of)) {
    __pyx_t_1 = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_2 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = Py_TYPE(__pyx_t_1)->tp_iternext;
  }
  for (;;) {
    if (PyList_CheckExact(__pyx_t_1)) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++;
    } else if (PyTuple_CheckExact(__pyx_t_1)) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++;
    } else {
      __pyx_t_9 = __pyx_t_2(__pyx_t_1);
      if (unlikely(!__pyx_t_9)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_9);
    }
    __Pyx_XDECREF(__pyx_v_ro);
    __pyx_v_ro = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "renpy/display/render.pyx":808
 * 
 *         for ro in self.render_of:
 *             cache = render_cache[ro]             # <<<<<<<<<<<<<<
 *             for k, v in cache.items():
 *                 if v is self:
 */
    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = PyObject_GetItem(__pyx_t_9, __pyx_v_ro); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_v_cache);
    __pyx_v_cache = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":809
 *         for ro in self.render_of:
 *             cache = render_cache[ro]
 *             for k, v in cache.items():             # <<<<<<<<<<<<<<
 *                 if v is self:
 *                     del cache[k]
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_cache, __pyx_n_s__items); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_9 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) {
      __pyx_t_4 = __pyx_t_9; __Pyx_INCREF(__pyx_t_4); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
    } else {
      __pyx_t_10 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = Py_TYPE(__pyx_t_4)->tp_iternext;
    }
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    for (;;) {
      if (PyList_CheckExact(__pyx_t_4)) {
        if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
      } else if (PyTuple_CheckExact(__pyx_t_4)) {
        if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++;
      } else {
        __pyx_t_9 = __pyx_t_11(__pyx_t_4);
        if (unlikely(!__pyx_t_9)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_9);
      }
      if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
        PyObject* sequence = __pyx_t_9;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_14 = Py_TYPE(__pyx_t_13)->tp_iternext;
        index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_3);
        index = 1; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L15_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        goto __pyx_L16_unpacking_done;
        __pyx_L15_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L16_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_k);
      __pyx_v_k = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "renpy/display/render.pyx":810
 *             cache = render_cache[ro]
 *             for k, v in cache.items():
 *                 if v is self:             # <<<<<<<<<<<<<<
 *                     del cache[k]
 * 
 */
      __pyx_t_8 = (__pyx_v_v == __pyx_v_self);
      if (__pyx_t_8) {
        if (unlikely(!__pyx_v_cache)) { __Pyx_RaiseUnboundLocalError("cache"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (unlikely(!__pyx_v_k)) { __Pyx_RaiseUnboundLocalError("k"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (PyObject_DelItem(__pyx_v_cache, __pyx_v_k) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

        /* "renpy/display/render.pyx":811
 *             for k, v in cache.items():
 *                 if v is self:
 *                     del cache[k]             # <<<<<<<<<<<<<<
 * 
 *             if not cache:
 */
        goto __pyx_L17;
      }
      __pyx_L17:;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":813
 *                     del cache[k]
 * 
 *             if not cache:             # <<<<<<<<<<<<<<
 *                 del render_cache[ro]
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_cache); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = (!__pyx_t_8);
    if (__pyx_t_7) {

      /* "renpy/display/render.pyx":814
 * 
 *             if not cache:
 *                 del render_cache[ro]             # <<<<<<<<<<<<<<
 * 
 *     def kill(self):
 */
      __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__render_cache); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(!__pyx_v_ro)) { __Pyx_RaiseUnboundLocalError("ro"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (PyObject_DelItem(__pyx_t_4, __pyx_v_ro) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L18;
    }
    __pyx_L18:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("renpy.display.render.Render.kill_cache", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_ro);
  __Pyx_XDECREF(__pyx_v_cache);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":816
 *                 del render_cache[ro]
 * 
 *     def kill(self):             # <<<<<<<<<<<<<<
 *         """
 *         Retained for compatibility.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_11kill(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_11kill[] = "\n        Retained for compatibility.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_11kill(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("kill");

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12add_focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_12add_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_pf_5renpy_7display_6render_6Render_12add_focus(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_arg = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_mx = 0;
  PyObject *__pyx_v_my = 0;
  PyObject *__pyx_v_mask = 0;
  PyObject *__pyx_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;
  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};
  __Pyx_RefNannySetupContext("add_focus");
  {
    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;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__d);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__arg);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask);
          if (value) { values[8] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_focus") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":834
 *         """
 * 
 *         if mask is not None and mask is not self:             # <<<<<<<<<<<<<<
 *             self.depends_on(mask)
 * 
 */
  __pyx_t_1 = (__pyx_v_mask != Py_None);
  if (__pyx_t_1) {
    __pyx_t_2 = (__pyx_v_mask != __pyx_v_self);
    __pyx_t_3 = __pyx_t_2;
  } else {
    __pyx_t_3 = __pyx_t_1;
  }
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":835
 * 
 *         if mask is not None and mask is not self:
 *             self.depends_on(mask)             # <<<<<<<<<<<<<<
 * 
 *         t = (d, arg, x, y, w, h, mx, my, mask)
 */
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__depends_on); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __Pyx_INCREF(__pyx_v_mask);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_mask);
    __Pyx_GIVEREF(__pyx_v_mask);
    __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":837
 *             self.depends_on(mask)
 * 
 *         t = (d, arg, x, y, w, h, mx, my, mask)             # <<<<<<<<<<<<<<
 * 
 *         if self.focuses is None:
 */
  __pyx_t_6 = PyTuple_New(9); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __Pyx_INCREF(__pyx_v_d);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_d);
  __Pyx_GIVEREF(__pyx_v_d);
  __Pyx_INCREF(__pyx_v_arg);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_arg);
  __Pyx_GIVEREF(__pyx_v_arg);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __Pyx_INCREF(__pyx_v_mx);
  PyTuple_SET_ITEM(__pyx_t_6, 6, __pyx_v_mx);
  __Pyx_GIVEREF(__pyx_v_mx);
  __Pyx_INCREF(__pyx_v_my);
  PyTuple_SET_ITEM(__pyx_t_6, 7, __pyx_v_my);
  __Pyx_GIVEREF(__pyx_v_my);
  __Pyx_INCREF(__pyx_v_mask);
  PyTuple_SET_ITEM(__pyx_t_6, 8, __pyx_v_mask);
  __Pyx_GIVEREF(__pyx_v_mask);
  __pyx_v_t = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "renpy/display/render.pyx":839
 *         t = (d, arg, x, y, w, h, mx, my, mask)
 * 
 *         if self.focuses is None:             # <<<<<<<<<<<<<<
 *             self.focuses = [ t ]
 *         else:
 */
  __pyx_t_3 = (((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses == ((PyObject*)Py_None));
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":840
 * 
 *         if self.focuses is None:
 *             self.focuses = [ t ]             # <<<<<<<<<<<<<<
 *         else:
 *             self.focuses.append(t)
 */
    __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_6));
    __Pyx_INCREF(((PyObject *)__pyx_v_t));
    PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_t));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_t));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_6));
    __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses);
    __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses));
    ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses = __pyx_t_6;
    __pyx_t_6 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "renpy/display/render.pyx":842
 *             self.focuses = [ t ]
 *         else:
 *             self.focuses.append(t)             # <<<<<<<<<<<<<<
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, reverse, x, y, focuses): #@DuplicatedSignature
 */
    if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_7 = PyList_Append(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses, ((PyObject *)__pyx_v_t)); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L7:;

  __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":844
 *             self.focuses.append(t)
 * 
 *     def take_focuses(self, cminx, cminy, cmaxx, cmaxy, reverse, x, y, focuses): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         This adds to focuses Focus objects corresponding to the focuses
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_13take_focuses(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_13take_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` - The clipping rectangle.\n        `reverse` - The transform from render to screen coordinates.\n        `x`, `y` - The offset of the upper-left corner of the render.\n        `focuses` - The list of focuses to add to.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_13take_focuses(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cminx = 0;
  PyObject *__pyx_v_cminy = 0;
  PyObject *__pyx_v_cmaxx = 0;
  PyObject *__pyx_v_cmaxy = 0;
  PyObject *__pyx_v_reverse = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_focuses = 0;
  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_x1 = NULL;
  PyObject *__pyx_v_y1 = NULL;
  PyObject *__pyx_v_x2 = NULL;
  PyObject *__pyx_v_y2 = NULL;
  PyObject *__pyx_v_minx = NULL;
  PyObject *__pyx_v_miny = NULL;
  PyObject *__pyx_v_maxx = NULL;
  PyObject *__pyx_v_maxy = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_focus = NULL;
  PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  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)(PyObject *);
  int __pyx_t_16;
  int __pyx_t_17;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__cminx,&__pyx_n_s__cminy,&__pyx_n_s__cmaxx,&__pyx_n_s__cmaxy,&__pyx_n_s__reverse,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__focuses,0};
  __Pyx_RefNannySetupContext("take_focuses");
  {
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cminx);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cminy);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cmaxx);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__cmaxy);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reverse);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[6])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__focuses);
        if (likely(values[7])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "take_focuses") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_cminx = values[0];
    __pyx_v_cminy = values[1];
    __pyx_v_cmaxx = values[2];
    __pyx_v_cmaxy = values[3];
    __pyx_v_reverse = values[4];
    __pyx_v_x = values[5];
    __pyx_v_y = values[6];
    __pyx_v_focuses = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("take_focuses", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __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_INCREF(__pyx_v_cminx);
  __Pyx_INCREF(__pyx_v_cminy);
  __Pyx_INCREF(__pyx_v_cmaxx);
  __Pyx_INCREF(__pyx_v_cmaxy);
  __Pyx_INCREF(__pyx_v_reverse);

  /* "renpy/display/render.pyx":856
 *         """
 * 
 *         if self.modal:             # <<<<<<<<<<<<<<
 *             focuses[:] = [ ]
 * 
 */
  if (((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->modal) {

    /* "renpy/display/render.pyx":857
 * 
 *         if self.modal:
 *             focuses[:] = [ ]             # <<<<<<<<<<<<<<
 * 
 *         if self.reverse:
 */
    __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    if (__Pyx_PySequence_SetSlice(__pyx_v_focuses, 0, PY_SSIZE_T_MAX, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":859
 *             focuses[:] = [ ]
 * 
 *         if self.reverse:             # <<<<<<<<<<<<<<
 *             reverse = reverse * self.reverse
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":860
 * 
 *         if self.reverse:
 *             reverse = reverse * self.reverse             # <<<<<<<<<<<<<<
 * 
 *         if self.focuses:
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_reverse, ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_reverse);
    __pyx_v_reverse = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "renpy/display/render.pyx":862
 *             reverse = reverse * self.reverse
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 */
  __pyx_t_2 = (((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses) != Py_None) && (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses)) != 0);
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":864
 *         if self.focuses:
 * 
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
    if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
      if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
        PyObject* sequence = __pyx_t_4;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 9)) {
            if (PyTuple_GET_SIZE(sequence) > 9) __Pyx_RaiseTooManyValuesError(9);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __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); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 6); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 7); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 8); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 9)) {
            if (PyList_GET_SIZE(sequence) > 9) __Pyx_RaiseTooManyValuesError(9);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __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_t_10 = PyList_GET_ITEM(sequence, 5); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 6); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 7); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 8); 
        }
        __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);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_13);
        __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_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext;
        index = 0; __pyx_t_5 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_5);
        index = 1; __pyx_t_6 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        index = 2; __pyx_t_7 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_7);
        index = 3; __pyx_t_8 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_8)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 4; __pyx_t_9 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 5; __pyx_t_10 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        index = 6; __pyx_t_11 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_11)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 7; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 8; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L12_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_d);
      __pyx_v_d = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_v_arg);
      __pyx_v_arg = __pyx_t_6;
      __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_v_xo);
      __pyx_v_xo = __pyx_t_7;
      __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_v_yo);
      __pyx_v_yo = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_v_w);
      __pyx_v_w = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_v_h);
      __pyx_v_h = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_v_mx);
      __pyx_v_mx = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_v_my);
      __pyx_v_my = __pyx_t_12;
      __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_v_mask);
      __pyx_v_mask = __pyx_t_13;
      __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":866
 *             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))
 *                     continue
 */
      __pyx_t_2 = (__pyx_v_xo == Py_None);
      if (__pyx_t_2) {

        /* "renpy/display/render.pyx":867
 * 
 *                 if xo is None:
 *                     focuses.append(renpy.display.focus.Focus(d, arg, None, None, None, None))             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
        __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_13 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyObject_GetAttr(__pyx_t_13, __pyx_n_s__focus); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Focus); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_4));
        __Pyx_INCREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        __Pyx_INCREF(__pyx_v_arg);
        PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_arg);
        __Pyx_GIVEREF(__pyx_v_arg);
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_4, 2, Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_4, 3, Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_4, 4, Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_INCREF(Py_None);
        PyTuple_SET_ITEM(__pyx_t_4, 5, Py_None);
        __Pyx_GIVEREF(Py_None);
        __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_focuses, __pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

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

      /* "renpy/display/render.pyx":870
 *                     continue
 * 
 *                 x1, y1 = reverse.transform(xo, yo)             # <<<<<<<<<<<<<<
 *                 x2, y2 = reverse.transform(xo + w, yo + h)
 * 
 */
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_reverse, __pyx_n_s__transform); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_12));
      __Pyx_INCREF(__pyx_v_xo);
      PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_xo);
      __Pyx_GIVEREF(__pyx_v_xo);
      __Pyx_INCREF(__pyx_v_yo);
      PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_yo);
      __Pyx_GIVEREF(__pyx_v_yo);
      __pyx_t_13 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_12), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) {
        PyObject* sequence = __pyx_t_13;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_12 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_11 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_15 = Py_TYPE(__pyx_t_11)->tp_iternext;
        index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_11); if (unlikely(!__pyx_t_12)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 1; __pyx_t_4 = __pyx_t_15(__pyx_t_11); if (unlikely(!__pyx_t_4)) goto __pyx_L14_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_4);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        goto __pyx_L15_unpacking_done;
        __pyx_L14_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L15_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_x1);
      __pyx_v_x1 = __pyx_t_12;
      __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_v_y1);
      __pyx_v_y1 = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":871
 * 
 *                 x1, y1 = reverse.transform(xo, yo)
 *                 x2, y2 = reverse.transform(xo + w, yo + h)             # <<<<<<<<<<<<<<
 * 
 *                 minx = min(x1, x2) + x
 */
      __pyx_t_13 = PyObject_GetAttr(__pyx_v_reverse, __pyx_n_s__transform); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_4 = PyNumber_Add(__pyx_v_xo, __pyx_v_w); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_12 = PyNumber_Add(__pyx_v_yo, __pyx_v_h); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_11));
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_12);
      __pyx_t_4 = 0;
      __pyx_t_12 = 0;
      __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_12))) || (PyList_CheckExact(__pyx_t_12))) {
        PyObject* sequence = __pyx_t_12;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_11 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_4 = PyObject_GetIter(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_15 = Py_TYPE(__pyx_t_4)->tp_iternext;
        index = 0; __pyx_t_11 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_11)) goto __pyx_L16_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_4); if (unlikely(!__pyx_t_13)) goto __pyx_L16_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        goto __pyx_L17_unpacking_done;
        __pyx_L16_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L17_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_x2);
      __pyx_v_x2 = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_v_y2);
      __pyx_v_y2 = __pyx_t_13;
      __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":873
 *                 x2, y2 = reverse.transform(xo + w, yo + h)
 * 
 *                 minx = min(x1, x2) + x             # <<<<<<<<<<<<<<
 *                 miny = min(y1, y2) + y
 *                 maxx = max(x1, x2) + x
 */
      __Pyx_INCREF(__pyx_v_x2);
      __pyx_t_12 = __pyx_v_x2;
      __Pyx_INCREF(__pyx_v_x1);
      __pyx_t_13 = __pyx_v_x1;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_t_13, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_11 = __pyx_t_12;
      } else {
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_11 = __pyx_t_13;
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyNumber_Add(__pyx_t_11, __pyx_v_x); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_v_minx);
      __pyx_v_minx = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "renpy/display/render.pyx":874
 * 
 *                 minx = min(x1, x2) + x
 *                 miny = min(y1, y2) + y             # <<<<<<<<<<<<<<
 *                 maxx = max(x1, x2) + x
 *                 maxy = max(y1, y2) + y
 */
      __Pyx_INCREF(__pyx_v_y2);
      __pyx_t_12 = __pyx_v_y2;
      __Pyx_INCREF(__pyx_v_y1);
      __pyx_t_11 = __pyx_v_y1;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_t_11, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_13 = __pyx_t_12;
      } else {
        __Pyx_INCREF(__pyx_t_11);
        __pyx_t_13 = __pyx_t_11;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyNumber_Add(__pyx_t_13, __pyx_v_y); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_v_miny);
      __pyx_v_miny = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "renpy/display/render.pyx":875
 *                 minx = min(x1, x2) + x
 *                 miny = min(y1, y2) + y
 *                 maxx = max(x1, x2) + x             # <<<<<<<<<<<<<<
 *                 maxy = max(y1, y2) + y
 * 
 */
      __Pyx_INCREF(__pyx_v_x2);
      __pyx_t_12 = __pyx_v_x2;
      __Pyx_INCREF(__pyx_v_x1);
      __pyx_t_13 = __pyx_v_x1;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_t_13, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_11 = __pyx_t_12;
      } else {
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_11 = __pyx_t_13;
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyNumber_Add(__pyx_t_11, __pyx_v_x); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_v_maxx);
      __pyx_v_maxx = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "renpy/display/render.pyx":876
 *                 miny = min(y1, y2) + y
 *                 maxx = max(x1, x2) + x
 *                 maxy = max(y1, y2) + y             # <<<<<<<<<<<<<<
 * 
 *                 minx = max(minx, cminx)
 */
      __Pyx_INCREF(__pyx_v_y2);
      __pyx_t_12 = __pyx_v_y2;
      __Pyx_INCREF(__pyx_v_y1);
      __pyx_t_11 = __pyx_v_y1;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_t_11, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_13 = __pyx_t_12;
      } else {
        __Pyx_INCREF(__pyx_t_11);
        __pyx_t_13 = __pyx_t_11;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyNumber_Add(__pyx_t_13, __pyx_v_y); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_v_maxy);
      __pyx_v_maxy = __pyx_t_12;
      __pyx_t_12 = 0;

      /* "renpy/display/render.pyx":878
 *                 maxy = max(y1, y2) + y
 * 
 *                 minx = max(minx, cminx)             # <<<<<<<<<<<<<<
 *                 miny = max(miny, cminy)
 *                 maxx = min(maxx, cmaxx)
 */
      __Pyx_INCREF(__pyx_v_cminx);
      __pyx_t_12 = __pyx_v_cminx;
      __Pyx_INCREF(__pyx_v_minx);
      __pyx_t_13 = __pyx_v_minx;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_t_13, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_11 = __pyx_t_12;
      } else {
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_11 = __pyx_t_13;
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_v_minx);
      __pyx_v_minx = __pyx_t_11;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "renpy/display/render.pyx":879
 * 
 *                 minx = max(minx, cminx)
 *                 miny = max(miny, cminy)             # <<<<<<<<<<<<<<
 *                 maxx = min(maxx, cmaxx)
 *                 maxy = min(maxy, cmaxy)
 */
      __Pyx_INCREF(__pyx_v_cminy);
      __pyx_t_11 = __pyx_v_cminy;
      __Pyx_INCREF(__pyx_v_miny);
      __pyx_t_12 = __pyx_v_miny;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_11, __pyx_t_12, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_11);
        __pyx_t_13 = __pyx_t_11;
      } else {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_13 = __pyx_t_12;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_v_miny);
      __pyx_v_miny = __pyx_t_13;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":880
 *                 minx = max(minx, cminx)
 *                 miny = max(miny, cminy)
 *                 maxx = min(maxx, cmaxx)             # <<<<<<<<<<<<<<
 *                 maxy = min(maxy, cmaxy)
 * 
 */
      __Pyx_INCREF(__pyx_v_cmaxx);
      __pyx_t_13 = __pyx_v_cmaxx;
      __Pyx_INCREF(__pyx_v_maxx);
      __pyx_t_11 = __pyx_v_maxx;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_13, __pyx_t_11, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_12 = __pyx_t_13;
      } else {
        __Pyx_INCREF(__pyx_t_11);
        __pyx_t_12 = __pyx_t_11;
      }
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_v_maxx);
      __pyx_v_maxx = __pyx_t_12;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

      /* "renpy/display/render.pyx":881
 *                 miny = max(miny, cminy)
 *                 maxx = min(maxx, cmaxx)
 *                 maxy = min(maxy, cmaxy)             # <<<<<<<<<<<<<<
 * 
 *                 if minx >= maxx or miny >= maxy:
 */
      __Pyx_INCREF(__pyx_v_cmaxy);
      __pyx_t_12 = __pyx_v_cmaxy;
      __Pyx_INCREF(__pyx_v_maxy);
      __pyx_t_13 = __pyx_v_maxy;
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_12, __pyx_t_13, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (__pyx_t_2) {
        __Pyx_INCREF(__pyx_t_12);
        __pyx_t_11 = __pyx_t_12;
      } else {
        __Pyx_INCREF(__pyx_t_13);
        __pyx_t_11 = __pyx_t_13;
      }
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_v_maxy);
      __pyx_v_maxy = __pyx_t_11;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "renpy/display/render.pyx":883
 *                 maxy = min(maxy, cmaxy)
 * 
 *                 if minx >= maxx or miny >= maxy:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_11 = PyObject_RichCompare(__pyx_v_minx, __pyx_v_maxx, Py_GE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (!__pyx_t_2) {
        __pyx_t_11 = PyObject_RichCompare(__pyx_v_miny, __pyx_v_maxy, Py_GE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_17 = __pyx_t_16;
      } else {
        __pyx_t_17 = __pyx_t_2;
      }
      if (__pyx_t_17) {

        /* "renpy/display/render.pyx":884
 * 
 *                 if minx >= maxx or miny >= maxy:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny))
 */
        goto __pyx_L9_continue;
        goto __pyx_L18;
      }
      __pyx_L18:;

      /* "renpy/display/render.pyx":886
 *                     continue
 * 
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny))             # <<<<<<<<<<<<<<
 * 
 *         if self.clipping:
 */
      __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__display); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__focus); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__Focus); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = PyNumber_Subtract(__pyx_v_maxx, __pyx_v_minx); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_13 = PyNumber_Subtract(__pyx_v_maxy, __pyx_v_miny); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      __Pyx_INCREF(__pyx_v_arg);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_arg);
      __Pyx_GIVEREF(__pyx_v_arg);
      __Pyx_INCREF(__pyx_v_minx);
      PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_minx);
      __Pyx_GIVEREF(__pyx_v_minx);
      __Pyx_INCREF(__pyx_v_miny);
      PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_miny);
      __Pyx_GIVEREF(__pyx_v_miny);
      PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_13);
      __Pyx_GIVEREF(__pyx_t_13);
      __pyx_t_11 = 0;
      __pyx_t_13 = 0;
      __pyx_t_13 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_Append(__pyx_v_focuses, __pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_L9_continue:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "renpy/display/render.pyx":888
 *                 focuses.append(renpy.display.focus.Focus(d, arg, minx, miny, maxx - minx, maxy - miny))
 * 
 *         if self.clipping:             # <<<<<<<<<<<<<<
 *             cminx = max(cminx, x)
 *             cminy = max(cminy, y)
 */
  if (((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->clipping) {

    /* "renpy/display/render.pyx":889
 * 
 *         if self.clipping:
 *             cminx = max(cminx, x)             # <<<<<<<<<<<<<<
 *             cminy = max(cminy, y)
 *             cmaxx = min(cmaxx, x + self.width)
 */
    __Pyx_INCREF(__pyx_v_x);
    __pyx_t_1 = __pyx_v_x;
    __Pyx_INCREF(__pyx_v_cminx);
    __pyx_t_4 = __pyx_v_cminx;
    __pyx_t_12 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (__pyx_t_17) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_13 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_13 = __pyx_t_4;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_v_cminx);
    __pyx_v_cminx = __pyx_t_13;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "renpy/display/render.pyx":890
 *         if self.clipping:
 *             cminx = max(cminx, x)
 *             cminy = max(cminy, y)             # <<<<<<<<<<<<<<
 *             cmaxx = min(cmaxx, x + self.width)
 *             cmaxy = min(cmaxx, x + self.height)
 */
    __Pyx_INCREF(__pyx_v_y);
    __pyx_t_13 = __pyx_v_y;
    __Pyx_INCREF(__pyx_v_cminy);
    __pyx_t_1 = __pyx_v_cminy;
    __pyx_t_12 = PyObject_RichCompare(__pyx_t_13, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (__pyx_t_17) {
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_4 = __pyx_t_13;
    } else {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_cminy);
    __pyx_v_cminy = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":891
 *             cminx = max(cminx, x)
 *             cminy = max(cminy, y)
 *             cmaxx = min(cmaxx, x + self.width)             # <<<<<<<<<<<<<<
 *             cmaxy = min(cmaxx, x + self.height)
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_13 = PyNumber_Add(__pyx_v_x, __pyx_t_4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_v_cmaxx);
    __pyx_t_4 = __pyx_v_cmaxx;
    __pyx_t_12 = PyObject_RichCompare(__pyx_t_13, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (__pyx_t_17) {
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_1 = __pyx_t_13;
    } else {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_t_4;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_cmaxx);
    __pyx_v_cmaxx = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/display/render.pyx":892
 *             cminy = max(cminy, y)
 *             cmaxx = min(cmaxx, x + self.width)
 *             cmaxy = min(cmaxx, x + self.height)             # <<<<<<<<<<<<<<
 * 
 *         for child, xo, yo, focus, main in self.children:
 */
    __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = PyNumber_Add(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_v_cmaxx);
    __pyx_t_1 = __pyx_v_cmaxx;
    __pyx_t_12 = PyObject_RichCompare(__pyx_t_13, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    if (__pyx_t_17) {
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_4 = __pyx_t_13;
    } else {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_cmaxy);
    __pyx_v_cmaxy = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L19;
  }
  __pyx_L19:;

  /* "renpy/display/render.pyx":894
 *             cmaxy = min(cmaxx, x + self.height)
 * 
 *         for child, xo, yo, focus, main in self.children:             # <<<<<<<<<<<<<<
 *             if not focus or not isinstance(child, Render):
 *                 continue
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
    __pyx_t_13 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++;
    if ((likely(PyTuple_CheckExact(__pyx_t_13))) || (PyList_CheckExact(__pyx_t_13))) {
      PyObject* sequence = __pyx_t_13;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
          if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
          if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_11 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_10 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_1 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_1)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_1);
      index = 1; __pyx_t_12 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_12)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      index = 2; __pyx_t_11 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_11)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      index = 3; __pyx_t_10 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_10)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      index = 4; __pyx_t_9 = __pyx_t_15(__pyx_t_8); if (unlikely(!__pyx_t_9)) goto __pyx_L22_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_8), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L23_unpacking_done;
      __pyx_L22_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L23_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_v_xo);
    __pyx_v_xo = __pyx_t_12;
    __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_v_yo);
    __pyx_v_yo = __pyx_t_11;
    __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_v_focus);
    __pyx_v_focus = __pyx_t_10;
    __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_v_main);
    __pyx_v_main = __pyx_t_9;
    __pyx_t_9 = 0;

    /* "renpy/display/render.pyx":895
 * 
 *         for child, xo, yo, focus, main in self.children:
 *             if not focus or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (!__pyx_t_17);
    if (!__pyx_t_2) {
      __pyx_t_13 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_17 = __Pyx_TypeCheck(__pyx_v_child, __pyx_t_13); 
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_16 = (!__pyx_t_17);
      __pyx_t_17 = __pyx_t_16;
    } else {
      __pyx_t_17 = __pyx_t_2;
    }
    if (__pyx_t_17) {

      /* "renpy/display/render.pyx":896
 *         for child, xo, yo, focus, main in self.children:
 *             if not focus or not isinstance(child, Render):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             xo, yo = reverse.transform(xo, yo)
 */
      goto __pyx_L20_continue;
      goto __pyx_L24;
    }
    __pyx_L24:;

    /* "renpy/display/render.pyx":898
 *                 continue
 * 
 *             xo, yo = reverse.transform(xo, yo)             # <<<<<<<<<<<<<<
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x + xo, y + yo, focuses)
 * 
 */
    __pyx_t_13 = PyObject_GetAttr(__pyx_v_reverse, __pyx_n_s__transform); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_9));
    __Pyx_INCREF(__pyx_v_xo);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_v_xo);
    __Pyx_GIVEREF(__pyx_v_xo);
    __Pyx_INCREF(__pyx_v_yo);
    PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_v_yo);
    __Pyx_GIVEREF(__pyx_v_yo);
    __pyx_t_10 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
    if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) {
      PyObject* sequence = __pyx_t_10;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
          if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_11 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_15 = Py_TYPE(__pyx_t_11)->tp_iternext;
      index = 0; __pyx_t_9 = __pyx_t_15(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L25_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_11); if (unlikely(!__pyx_t_13)) goto __pyx_L25_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_13);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      goto __pyx_L26_unpacking_done;
      __pyx_L25_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L26_unpacking_done:;
    }
    __Pyx_DECREF(__pyx_v_xo);
    __pyx_v_xo = __pyx_t_9;
    __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_v_yo);
    __pyx_v_yo = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "renpy/display/render.pyx":899
 * 
 *             xo, yo = reverse.transform(xo, yo)
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x + xo, y + yo, focuses)             # <<<<<<<<<<<<<<
 * 
 *         if self.pass_focuses:
 */
    __pyx_t_10 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__take_focuses); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_13 = PyNumber_Add(__pyx_v_x, __pyx_v_xo); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_9 = PyNumber_Add(__pyx_v_y, __pyx_v_yo); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = PyTuple_New(8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_11));
    __Pyx_INCREF(__pyx_v_cminx);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_cminx);
    __Pyx_GIVEREF(__pyx_v_cminx);
    __Pyx_INCREF(__pyx_v_cminy);
    PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_cminy);
    __Pyx_GIVEREF(__pyx_v_cminy);
    __Pyx_INCREF(__pyx_v_cmaxx);
    PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_cmaxx);
    __Pyx_GIVEREF(__pyx_v_cmaxx);
    __Pyx_INCREF(__pyx_v_cmaxy);
    PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_v_cmaxy);
    __Pyx_GIVEREF(__pyx_v_cmaxy);
    __Pyx_INCREF(__pyx_v_reverse);
    PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_v_reverse);
    __Pyx_GIVEREF(__pyx_v_reverse);
    PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_11, 6, __pyx_t_9);
    __Pyx_GIVEREF(__pyx_t_9);
    __Pyx_INCREF(__pyx_v_focuses);
    PyTuple_SET_ITEM(__pyx_t_11, 7, __pyx_v_focuses);
    __Pyx_GIVEREF(__pyx_v_focuses);
    __pyx_t_13 = 0;
    __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_L20_continue:;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/display/render.pyx":901
 *             child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x + xo, y + yo, focuses)
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, focuses)
 */
  __pyx_t_17 = (((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses) != Py_None) && (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses)) != 0);
  if (__pyx_t_17) {

    /* "renpy/display/render.pyx":902
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, focuses)
 * 
 */
    if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_4 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses); __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0;
    for (;;) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_9 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_9); __pyx_t_3++;
      __Pyx_XDECREF(__pyx_v_child);
      __pyx_v_child = __pyx_t_9;
      __pyx_t_9 = 0;

      /* "renpy/display/render.pyx":903
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, focuses)             # <<<<<<<<<<<<<<
 * 
 *     def focus_at_point(self, x, y): #@DuplicatedSignature
 */
      __pyx_t_9 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__take_focuses); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = PyTuple_New(8); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_11));
      __Pyx_INCREF(__pyx_v_cminx);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_cminx);
      __Pyx_GIVEREF(__pyx_v_cminx);
      __Pyx_INCREF(__pyx_v_cminy);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_cminy);
      __Pyx_GIVEREF(__pyx_v_cminy);
      __Pyx_INCREF(__pyx_v_cmaxx);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_v_cmaxx);
      __Pyx_GIVEREF(__pyx_v_cmaxx);
      __Pyx_INCREF(__pyx_v_cmaxy);
      PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_v_cmaxy);
      __Pyx_GIVEREF(__pyx_v_cmaxy);
      __Pyx_INCREF(__pyx_v_reverse);
      PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_v_reverse);
      __Pyx_GIVEREF(__pyx_v_reverse);
      __Pyx_INCREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_11, 6, __pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      __Pyx_INCREF(__pyx_v_focuses);
      PyTuple_SET_ITEM(__pyx_t_11, 7, __pyx_v_focuses);
      __Pyx_GIVEREF(__pyx_v_focuses);
      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L27;
  }
  __pyx_L27:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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_AddTraceback("renpy.display.render.Render.take_focuses", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_xo);
  __Pyx_XDECREF(__pyx_v_yo);
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_h);
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_mask);
  __Pyx_XDECREF(__pyx_v_x1);
  __Pyx_XDECREF(__pyx_v_y1);
  __Pyx_XDECREF(__pyx_v_x2);
  __Pyx_XDECREF(__pyx_v_y2);
  __Pyx_XDECREF(__pyx_v_minx);
  __Pyx_XDECREF(__pyx_v_miny);
  __Pyx_XDECREF(__pyx_v_maxx);
  __Pyx_XDECREF(__pyx_v_maxy);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_cminx);
  __Pyx_XDECREF(__pyx_v_cminy);
  __Pyx_XDECREF(__pyx_v_cmaxx);
  __Pyx_XDECREF(__pyx_v_cmaxy);
  __Pyx_XDECREF(__pyx_v_reverse);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":905
 *                 child.take_focuses(cminx, cminy, cmaxx, cmaxy, reverse, x, y, focuses)
 * 
 *     def focus_at_point(self, x, y): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         This returns the focus of this object at the given point.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_14focus_at_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_14focus_at_point[] = "\n        This returns the focus of this object at the given point.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_14focus_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_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;
  PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_cf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  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 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *(*__pyx_t_19)(PyObject *);
  double __pyx_t_20;
  double __pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("focus_at_point");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("focus_at_point", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "focus_at_point") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":910
 *         """
 * 
 *         if self.clipping:             # <<<<<<<<<<<<<<
 *             if x < 0 or x >= self.width or y < 0 or y >= self.height:
 *                 return None
 */
  if (((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->clipping) {

    /* "renpy/display/render.pyx":911
 * 
 *         if self.clipping:
 *             if x < 0 or x >= self.width or y < 0 or y >= self.height:             # <<<<<<<<<<<<<<
 *                 return None
 * 
 */
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_2) {
      __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_x, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_4) {
        __pyx_t_3 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (!__pyx_t_5) {
          __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_t_3, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_7 = __pyx_t_6;
        } else {
          __pyx_t_7 = __pyx_t_5;
        }
        __pyx_t_5 = __pyx_t_7;
      } else {
        __pyx_t_5 = __pyx_t_4;
      }
      __pyx_t_4 = __pyx_t_5;
    } else {
      __pyx_t_4 = __pyx_t_2;
    }
    if (__pyx_t_4) {

      /* "renpy/display/render.pyx":912
 *         if self.clipping:
 *             if x < 0 or x >= self.width or y < 0 or y >= self.height:
 *                 return None             # <<<<<<<<<<<<<<
 * 
 *         rv = None
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  __pyx_L6:;

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

  /* "renpy/display/render.pyx":916
 *         rv = None
 * 
 *         if self.focuses:             # <<<<<<<<<<<<<<
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 */
  __pyx_t_4 = (((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses) != Py_None) && (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses)) != 0);
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":917
 * 
 *         if self.focuses:
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:             # <<<<<<<<<<<<<<
 * 
 *                 if xo is None:
 */
    if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses); __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
    for (;;) {
      if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++;
      if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
        PyObject* sequence = __pyx_t_3;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 9)) {
            if (PyTuple_GET_SIZE(sequence) > 9) __Pyx_RaiseTooManyValuesError(9);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1); 
          __pyx_t_11 = PyTuple_GET_ITEM(sequence, 2); 
          __pyx_t_12 = PyTuple_GET_ITEM(sequence, 3); 
          __pyx_t_13 = PyTuple_GET_ITEM(sequence, 4); 
          __pyx_t_14 = PyTuple_GET_ITEM(sequence, 5); 
          __pyx_t_15 = PyTuple_GET_ITEM(sequence, 6); 
          __pyx_t_16 = PyTuple_GET_ITEM(sequence, 7); 
          __pyx_t_17 = PyTuple_GET_ITEM(sequence, 8); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 9)) {
            if (PyList_GET_SIZE(sequence) > 9) __Pyx_RaiseTooManyValuesError(9);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_9 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_10 = PyList_GET_ITEM(sequence, 1); 
          __pyx_t_11 = PyList_GET_ITEM(sequence, 2); 
          __pyx_t_12 = PyList_GET_ITEM(sequence, 3); 
          __pyx_t_13 = PyList_GET_ITEM(sequence, 4); 
          __pyx_t_14 = PyList_GET_ITEM(sequence, 5); 
          __pyx_t_15 = PyList_GET_ITEM(sequence, 6); 
          __pyx_t_16 = PyList_GET_ITEM(sequence, 7); 
          __pyx_t_17 = PyList_GET_ITEM(sequence, 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);
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_16);
        __Pyx_INCREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_18 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_18);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_19 = Py_TYPE(__pyx_t_18)->tp_iternext;
        index = 0; __pyx_t_9 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_9);
        index = 1; __pyx_t_10 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_10);
        index = 2; __pyx_t_11 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_11)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_11);
        index = 3; __pyx_t_12 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_12)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_12);
        index = 4; __pyx_t_13 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_13)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_13);
        index = 5; __pyx_t_14 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_14)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_14);
        index = 6; __pyx_t_15 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_15)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_15);
        index = 7; __pyx_t_16 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_16)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_16);
        index = 8; __pyx_t_17 = __pyx_t_19(__pyx_t_18); if (unlikely(!__pyx_t_17)) goto __pyx_L11_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_17);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_18), 9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        goto __pyx_L12_unpacking_done;
        __pyx_L11_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L12_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_d);
      __pyx_v_d = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_v_arg);
      __pyx_v_arg = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_v_xo);
      __pyx_v_xo = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_v_yo);
      __pyx_v_yo = __pyx_t_12;
      __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_v_w);
      __pyx_v_w = __pyx_t_13;
      __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_v_h);
      __pyx_v_h = __pyx_t_14;
      __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_v_mx);
      __pyx_v_mx = __pyx_t_15;
      __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_v_my);
      __pyx_v_my = __pyx_t_16;
      __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_v_mask);
      __pyx_v_mask = __pyx_t_17;
      __pyx_t_17 = 0;

      /* "renpy/display/render.pyx":919
 *             for (d, arg, xo, yo, w, h, mx, my, mask) in self.focuses:
 * 
 *                 if xo is None:             # <<<<<<<<<<<<<<
 *                     continue
 * 
 */
      __pyx_t_4 = (__pyx_v_xo == Py_None);
      if (__pyx_t_4) {

        /* "renpy/display/render.pyx":920
 * 
 *                 if xo is None:
 *                     continue             # <<<<<<<<<<<<<<
 * 
 *                 elif mx is not None:
 */
        goto __pyx_L9_continue;
        goto __pyx_L13;
      }

      /* "renpy/display/render.pyx":922
 *                     continue
 * 
 *                 elif mx is not None:             # <<<<<<<<<<<<<<
 *                     cx = x - mx
 *                     cy = y - my
 */
      __pyx_t_4 = (__pyx_v_mx != Py_None);
      if (__pyx_t_4) {

        /* "renpy/display/render.pyx":923
 * 
 *                 elif mx is not None:
 *                     cx = x - mx             # <<<<<<<<<<<<<<
 *                     cy = y - my
 * 
 */
        __pyx_t_3 = PyNumber_Subtract(__pyx_v_x, __pyx_v_mx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF(__pyx_v_cx);
        __pyx_v_cx = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "renpy/display/render.pyx":924
 *                 elif mx is not None:
 *                     cx = x - mx
 *                     cy = y - my             # <<<<<<<<<<<<<<
 * 
 *                     if self.forward:
 */
        __pyx_t_3 = PyNumber_Subtract(__pyx_v_y, __pyx_v_my); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_XDECREF(__pyx_v_cy);
        __pyx_v_cy = __pyx_t_3;
        __pyx_t_3 = 0;

        /* "renpy/display/render.pyx":926
 *                     cy = y - my
 * 
 *                     if self.forward:             # <<<<<<<<<<<<<<
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        if (__pyx_t_4) {

          /* "renpy/display/render.pyx":927
 * 
 *                     if self.forward:
 *                         cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *                     if mask.is_pixel_opaque(cx, cy):
 */
          __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_cx); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_cy); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward->__pyx_vtab)->transform(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward, __pyx_t_20, __pyx_t_21, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_3);
          if (likely(PyTuple_CheckExact(__pyx_t_3))) {
            PyObject* sequence = __pyx_t_3;
            if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
              if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
              else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
              {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
            }
            __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1); 
            __Pyx_INCREF(__pyx_t_17);
            __Pyx_INCREF(__pyx_t_16);
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          } else {
            __Pyx_UnpackTupleError(__pyx_t_3, 2);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __Pyx_DECREF(__pyx_v_cx);
          __pyx_v_cx = __pyx_t_17;
          __pyx_t_17 = 0;
          __Pyx_DECREF(__pyx_v_cy);
          __pyx_v_cy = __pyx_t_16;
          __pyx_t_16 = 0;
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "renpy/display/render.pyx":929
 *                         cx, cy = self.forward.transform(cx, cy)
 * 
 *                     if mask.is_pixel_opaque(cx, cy):             # <<<<<<<<<<<<<<
 *                         rv = d, arg
 * 
 */
        __pyx_t_3 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__is_pixel_opaque); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_16 = PyTuple_New(2); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_16));
        __Pyx_INCREF(__pyx_v_cx);
        PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_v_cx);
        __Pyx_GIVEREF(__pyx_v_cx);
        __Pyx_INCREF(__pyx_v_cy);
        PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_v_cy);
        __Pyx_GIVEREF(__pyx_v_cy);
        __pyx_t_17 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_16), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_16)); __pyx_t_16 = 0;
        __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        if (__pyx_t_4) {

          /* "renpy/display/render.pyx":930
 * 
 *                     if mask.is_pixel_opaque(cx, cy):
 *                         rv = d, arg             # <<<<<<<<<<<<<<
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:
 */
          __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_17));
          __Pyx_INCREF(__pyx_v_d);
          PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_d);
          __Pyx_GIVEREF(__pyx_v_d);
          __Pyx_INCREF(__pyx_v_arg);
          PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_arg);
          __Pyx_GIVEREF(__pyx_v_arg);
          __Pyx_DECREF(__pyx_v_rv);
          __pyx_v_rv = ((PyObject *)__pyx_t_17);
          __pyx_t_17 = 0;
          goto __pyx_L15;
        }
        __pyx_L15:;
        goto __pyx_L13;
      }

      /* "renpy/display/render.pyx":932
 *                         rv = d, arg
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:             # <<<<<<<<<<<<<<
 *                     rv = d, arg
 * 
 */
      __pyx_t_17 = PyObject_RichCompare(__pyx_v_xo, __pyx_v_x, Py_LE); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      if (__Pyx_PyObject_IsTrue(__pyx_t_17)) {
        __Pyx_DECREF(__pyx_t_17);
        __pyx_t_16 = PyNumber_Add(__pyx_v_xo, __pyx_v_w); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_16);
        __pyx_t_17 = PyObject_RichCompare(__pyx_v_x, __pyx_t_16, Py_LT); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      }
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      if (__pyx_t_4) {
        __pyx_t_17 = PyObject_RichCompare(__pyx_v_yo, __pyx_v_y, Py_LE); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_17);
        if (__Pyx_PyObject_IsTrue(__pyx_t_17)) {
          __Pyx_DECREF(__pyx_t_17);
          __pyx_t_16 = PyNumber_Add(__pyx_v_yo, __pyx_v_h); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_16);
          __pyx_t_17 = PyObject_RichCompare(__pyx_v_y, __pyx_t_16, Py_LT); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(__pyx_t_17);
          __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
        }
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_17); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
        __pyx_t_5 = __pyx_t_2;
      } else {
        __pyx_t_5 = __pyx_t_4;
      }
      if (__pyx_t_5) {

        /* "renpy/display/render.pyx":933
 * 
 *                 elif xo <= x < xo + w and yo <= y < yo + h:
 *                     rv = d, arg             # <<<<<<<<<<<<<<
 * 
 *         for child, xo, yo, focus, main in self.children:
 */
        __pyx_t_17 = PyTuple_New(2); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_17));
        __Pyx_INCREF(__pyx_v_d);
        PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_v_d);
        __Pyx_GIVEREF(__pyx_v_d);
        __Pyx_INCREF(__pyx_v_arg);
        PyTuple_SET_ITEM(__pyx_t_17, 1, __pyx_v_arg);
        __Pyx_GIVEREF(__pyx_v_arg);
        __Pyx_DECREF(__pyx_v_rv);
        __pyx_v_rv = ((PyObject *)__pyx_t_17);
        __pyx_t_17 = 0;
        goto __pyx_L13;
      }
      __pyx_L13:;
      __pyx_L9_continue:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "renpy/display/render.pyx":935
 *                     rv = d, arg
 * 
 *         for child, xo, yo, focus, main in self.children:             # <<<<<<<<<<<<<<
 * 
 *             if not focus or not isinstance(child, Render):
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children); __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_17 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_17); __pyx_t_8++;
    if ((likely(PyTuple_CheckExact(__pyx_t_17))) || (PyList_CheckExact(__pyx_t_17))) {
      PyObject* sequence = __pyx_t_17;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
          if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
          if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_16 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_16);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_12 = PyObject_GetIter(__pyx_t_17); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_19 = Py_TYPE(__pyx_t_12)->tp_iternext;
      index = 0; __pyx_t_16 = __pyx_t_19(__pyx_t_12); if (unlikely(!__pyx_t_16)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_16);
      index = 1; __pyx_t_3 = __pyx_t_19(__pyx_t_12); if (unlikely(!__pyx_t_3)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 2; __pyx_t_15 = __pyx_t_19(__pyx_t_12); if (unlikely(!__pyx_t_15)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      index = 3; __pyx_t_14 = __pyx_t_19(__pyx_t_12); if (unlikely(!__pyx_t_14)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 4; __pyx_t_13 = __pyx_t_19(__pyx_t_12); if (unlikely(!__pyx_t_13)) goto __pyx_L18_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_13);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_19(__pyx_t_12), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L19_unpacking_done;
      __pyx_L18_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 935; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L19_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_16;
    __pyx_t_16 = 0;
    __Pyx_XDECREF(__pyx_v_xo);
    __pyx_v_xo = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_yo);
    __pyx_v_yo = __pyx_t_15;
    __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_v_focus);
    __pyx_v_focus = __pyx_t_14;
    __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_v_main);
    __pyx_v_main = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "renpy/display/render.pyx":937
 *         for child, xo, yo, focus, main in self.children:
 * 
 *             if not focus or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_focus); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = (!__pyx_t_5);
    if (!__pyx_t_4) {
      __pyx_t_17 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
      __Pyx_INCREF(__pyx_t_17);
      __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_child, __pyx_t_17); 
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      __pyx_t_2 = (!__pyx_t_5);
      __pyx_t_5 = __pyx_t_2;
    } else {
      __pyx_t_5 = __pyx_t_4;
    }
    if (__pyx_t_5) {

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

    /* "renpy/display/render.pyx":940
 *                 continue
 * 
 *             cx = x - xo             # <<<<<<<<<<<<<<
 *             cy = y - yo
 * 
 */
    __pyx_t_17 = PyNumber_Subtract(__pyx_v_x, __pyx_v_xo); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_XDECREF(__pyx_v_cx);
    __pyx_v_cx = __pyx_t_17;
    __pyx_t_17 = 0;

    /* "renpy/display/render.pyx":941
 * 
 *             cx = x - xo
 *             cy = y - yo             # <<<<<<<<<<<<<<
 * 
 *             if self.forward:
 */
    __pyx_t_17 = PyNumber_Subtract(__pyx_v_y, __pyx_v_yo); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __Pyx_XDECREF(__pyx_v_cy);
    __pyx_v_cy = __pyx_t_17;
    __pyx_t_17 = 0;

    /* "renpy/display/render.pyx":943
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "renpy/display/render.pyx":944
 * 
 *             if self.forward:
 *                 cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *             cf = child.focus_at_point(cx, cy)
 */
      __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_cx); if (unlikely((__pyx_t_21 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_cy); if (unlikely((__pyx_t_20 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_17 = ((PyObject *)((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward->__pyx_vtab)->transform(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward, __pyx_t_21, __pyx_t_20, 0)); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      if (likely(PyTuple_CheckExact(__pyx_t_17))) {
        PyObject* sequence = __pyx_t_17;
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_13);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      } else {
        __Pyx_UnpackTupleError(__pyx_t_17, 2);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_v_cx);
      __pyx_v_cx = __pyx_t_13;
      __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_v_cy);
      __pyx_v_cy = __pyx_t_14;
      __pyx_t_14 = 0;
      goto __pyx_L21;
    }
    __pyx_L21:;

    /* "renpy/display/render.pyx":946
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 *             cf = child.focus_at_point(cx, cy)             # <<<<<<<<<<<<<<
 *             if cf is not None:
 *                 rv = cf
 */
    __pyx_t_17 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__focus_at_point); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_17);
    __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    __Pyx_INCREF(__pyx_v_cx);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_cx);
    __Pyx_GIVEREF(__pyx_v_cx);
    __Pyx_INCREF(__pyx_v_cy);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_cy);
    __Pyx_GIVEREF(__pyx_v_cy);
    __pyx_t_13 = PyObject_Call(__pyx_t_17, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_v_cf);
    __pyx_v_cf = __pyx_t_13;
    __pyx_t_13 = 0;

    /* "renpy/display/render.pyx":947
 * 
 *             cf = child.focus_at_point(cx, cy)
 *             if cf is not None:             # <<<<<<<<<<<<<<
 *                 rv = cf
 * 
 */
    __pyx_t_5 = (__pyx_v_cf != Py_None);
    if (__pyx_t_5) {

      /* "renpy/display/render.pyx":948
 *             cf = child.focus_at_point(cx, cy)
 *             if cf is not None:
 *                 rv = cf             # <<<<<<<<<<<<<<
 * 
 *         if self.pass_focuses:
 */
      __Pyx_INCREF(__pyx_v_cf);
      __Pyx_DECREF(__pyx_v_rv);
      __pyx_v_rv = __pyx_v_cf;
      goto __pyx_L22;
    }
    __pyx_L22:;
    __pyx_L16_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":950
 *                 rv = cf
 * 
 *         if self.pass_focuses:             # <<<<<<<<<<<<<<
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y)
 */
  __pyx_t_5 = (((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses) != Py_None) && (PyList_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses)) != 0);
  if (__pyx_t_5) {

    /* "renpy/display/render.pyx":951
 * 
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:             # <<<<<<<<<<<<<<
 *                 cf = child.focus_at_point(x, y)
 *                 if cf is not None:
 */
    if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses); __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
    for (;;) {
      if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
      __pyx_t_13 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_13); __pyx_t_8++;
      __Pyx_XDECREF(__pyx_v_child);
      __pyx_v_child = __pyx_t_13;
      __pyx_t_13 = 0;

      /* "renpy/display/render.pyx":952
 *         if self.pass_focuses:
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y)             # <<<<<<<<<<<<<<
 *                 if cf is not None:
 *                     rv = cf
 */
      __pyx_t_13 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__focus_at_point); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_14));
      __Pyx_INCREF(__pyx_v_x);
      PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_x);
      __Pyx_GIVEREF(__pyx_v_x);
      __Pyx_INCREF(__pyx_v_y);
      PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_y);
      __Pyx_GIVEREF(__pyx_v_y);
      __pyx_t_17 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_17);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_v_cf);
      __pyx_v_cf = __pyx_t_17;
      __pyx_t_17 = 0;

      /* "renpy/display/render.pyx":953
 *             for child in self.pass_focuses:
 *                 cf = child.focus_at_point(x, y)
 *                 if cf is not None:             # <<<<<<<<<<<<<<
 *                     rv = cf
 * 
 */
      __pyx_t_5 = (__pyx_v_cf != Py_None);
      if (__pyx_t_5) {

        /* "renpy/display/render.pyx":954
 *                 cf = child.focus_at_point(x, y)
 *                 if cf is not None:
 *                     rv = cf             # <<<<<<<<<<<<<<
 * 
 *         if rv is None and self.modal:
 */
        __Pyx_INCREF(__pyx_v_cf);
        __Pyx_DECREF(__pyx_v_rv);
        __pyx_v_rv = __pyx_v_cf;
        goto __pyx_L26;
      }
      __pyx_L26:;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L23;
  }
  __pyx_L23:;

  /* "renpy/display/render.pyx":956
 *                     rv = cf
 * 
 *         if rv is None and self.modal:             # <<<<<<<<<<<<<<
 *             rv = Modal
 * 
 */
  __pyx_t_5 = (__pyx_v_rv == Py_None);
  if (__pyx_t_5) {
    __pyx_t_4 = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->modal;
  } else {
    __pyx_t_4 = __pyx_t_5;
  }
  if (__pyx_t_4) {

    /* "renpy/display/render.pyx":957
 * 
 *         if rv is None and self.modal:
 *             rv = Modal             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__Modal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_rv);
    __pyx_v_rv = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L27;
  }
  __pyx_L27:;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __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_XDECREF(__pyx_t_17);
  __Pyx_XDECREF(__pyx_t_18);
  __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_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":962
 * 
 * 
 *     def main_displayables_at_point(self, x, y, layers, depth=None):             # <<<<<<<<<<<<<<
 *         """
 *         Returns the displayable at `x`, `y` on one of the layers in
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15main_displayables_at_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_15main_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_pf_5renpy_7display_6render_6Render_15main_displayables_at_point(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_layers = 0;
  PyObject *__pyx_v_depth = 0;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_v_d = NULL;
  PyObject *__pyx_v_child = NULL;
  PyObject *__pyx_v_xo = NULL;
  PyObject *__pyx_v_yo = NULL;
  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;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __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)(PyObject *);
  double __pyx_t_18;
  double __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__layers,&__pyx_n_s__depth,0};
  __Pyx_RefNannySetupContext("main_displayables_at_point");
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("main_displayables_at_point", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__layers);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("main_displayables_at_point", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__depth);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "main_displayables_at_point") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __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_INCREF(__pyx_v_depth);

  /* "renpy/display/render.pyx":968
 *         """
 * 
 *         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_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":970
 *         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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_2) {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
      __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_5) {
        __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_t_4, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = __pyx_t_6;
      } else {
        __pyx_t_7 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_7;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":971
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:
 *             return rv             # <<<<<<<<<<<<<<
 * 
 *         if depth is not None:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_rv));
    __pyx_r = ((PyObject *)__pyx_v_rv);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":973
 *             return rv
 * 
 *         if depth is not None:             # <<<<<<<<<<<<<<
 *             for d in self.render_of:
 *                 rv.append((depth, self.width, self.height, d))
 */
  __pyx_t_3 = (__pyx_v_depth != Py_None);
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":974
 * 
 *         if depth is not None:
 *             for d in self.render_of:             # <<<<<<<<<<<<<<
 *                 rv.append((depth, self.width, self.height, d))
 *                 depth += 1
 */
    if (PyList_CheckExact(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of) || PyTuple_CheckExact(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of)) {
      __pyx_t_1 = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_1 = PyObject_GetIter(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_9 = Py_TYPE(__pyx_t_1)->tp_iternext;
    }
    for (;;) {
      if (PyList_CheckExact(__pyx_t_1)) {
        if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
      } else if (PyTuple_CheckExact(__pyx_t_1)) {
        if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++;
      } else {
        __pyx_t_4 = __pyx_t_9(__pyx_t_1);
        if (unlikely(!__pyx_t_4)) {
          if (PyErr_Occurred()) {
            if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_4);
      }
      __Pyx_XDECREF(__pyx_v_d);
      __pyx_v_d = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "renpy/display/render.pyx":975
 *         if depth is not None:
 *             for d in self.render_of:
 *                 rv.append((depth, self.width, self.height, d))             # <<<<<<<<<<<<<<
 *                 depth += 1
 *         elif self.layer_name in layers:
 */
      if (unlikely(((PyObject *)__pyx_v_rv) == Py_None)) {
        PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
      }
      __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_10 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_11));
      __Pyx_INCREF(__pyx_v_depth);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_depth);
      __Pyx_GIVEREF(__pyx_v_depth);
      PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_v_d);
      PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_v_d);
      __Pyx_GIVEREF(__pyx_v_d);
      __pyx_t_4 = 0;
      __pyx_t_10 = 0;
      __pyx_t_12 = PyList_Append(__pyx_v_rv, ((PyObject *)__pyx_t_11)); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;

      /* "renpy/display/render.pyx":976
 *             for d in self.render_of:
 *                 rv.append((depth, self.width, self.height, d))
 *                 depth += 1             # <<<<<<<<<<<<<<
 *         elif self.layer_name in layers:
 *             depth = 0
 */
      __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_depth, __pyx_int_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_v_depth);
      __pyx_v_depth = __pyx_t_11;
      __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L7;
  }

  /* "renpy/display/render.pyx":977
 *                 rv.append((depth, self.width, self.height, d))
 *                 depth += 1
 *         elif self.layer_name in layers:             # <<<<<<<<<<<<<<
 *             depth = 0
 * 
 */
  __pyx_t_3 = ((PySequence_Contains(__pyx_v_layers, ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name))); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":978
 *                 depth += 1
 *         elif self.layer_name in layers:
 *             depth = 0             # <<<<<<<<<<<<<<
 * 
 *         for (child, xo, yo, focus, main) in self.children:
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF(__pyx_v_depth);
    __pyx_v_depth = __pyx_int_0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "renpy/display/render.pyx":980
 *             depth = 0
 * 
 *         for (child, xo, yo, focus, main) in self.children:             # <<<<<<<<<<<<<<
 *             if not main or not isinstance(child, Render):
 *                 continue
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children); __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0;
  for (;;) {
    if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_11 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_11); __pyx_t_8++;
    if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) {
      PyObject* sequence = __pyx_t_11;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
          if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_10 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
          if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_10 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_10);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_16 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_17 = Py_TYPE(__pyx_t_16)->tp_iternext;
      index = 0; __pyx_t_10 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_10)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      index = 1; __pyx_t_4 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_4)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_13 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_13)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_13);
      index = 3; __pyx_t_14 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_14)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      index = 4; __pyx_t_15 = __pyx_t_17(__pyx_t_16); if (unlikely(!__pyx_t_15)) goto __pyx_L12_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_15);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_17(__pyx_t_16), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      goto __pyx_L13_unpacking_done;
      __pyx_L12_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L13_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_10;
    __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_v_xo);
    __pyx_v_xo = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_v_yo);
    __pyx_v_yo = __pyx_t_13;
    __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_v_focus);
    __pyx_v_focus = __pyx_t_14;
    __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_v_main);
    __pyx_v_main = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "renpy/display/render.pyx":981
 * 
 *         for (child, xo, yo, focus, main) in self.children:
 *             if not main or not isinstance(child, Render):             # <<<<<<<<<<<<<<
 *                 continue
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_main); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = (!__pyx_t_3);
    if (!__pyx_t_2) {
      __pyx_t_11 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_child, __pyx_t_11); 
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_5 = (!__pyx_t_3);
      __pyx_t_3 = __pyx_t_5;
    } else {
      __pyx_t_3 = __pyx_t_2;
    }
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":982
 *         for (child, xo, yo, focus, main) in self.children:
 *             if not main or not isinstance(child, Render):
 *                 continue             # <<<<<<<<<<<<<<
 * 
 *             cx = x - xo
 */
      goto __pyx_L10_continue;
      goto __pyx_L14;
    }
    __pyx_L14:;

    /* "renpy/display/render.pyx":984
 *                 continue
 * 
 *             cx = x - xo             # <<<<<<<<<<<<<<
 *             cy = y - yo
 * 
 */
    __pyx_t_11 = PyNumber_Subtract(__pyx_v_x, __pyx_v_xo); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_XDECREF(__pyx_v_cx);
    __pyx_v_cx = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "renpy/display/render.pyx":985
 * 
 *             cx = x - xo
 *             cy = y - yo             # <<<<<<<<<<<<<<
 * 
 *             if self.forward:
 */
    __pyx_t_11 = PyNumber_Subtract(__pyx_v_y, __pyx_v_yo); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_XDECREF(__pyx_v_cy);
    __pyx_v_cy = __pyx_t_11;
    __pyx_t_11 = 0;

    /* "renpy/display/render.pyx":987
 *             cy = y - yo
 * 
 *             if self.forward:             # <<<<<<<<<<<<<<
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_3) {

      /* "renpy/display/render.pyx":988
 * 
 *             if self.forward:
 *                 cx, cy = self.forward.transform(cx, cy)             # <<<<<<<<<<<<<<
 * 
 *             cf = child.main_displayables_at_point(cx, cy, layers, depth)
 */
      __pyx_t_18 = __pyx_PyFloat_AsDouble(__pyx_v_cx); if (unlikely((__pyx_t_18 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_19 = __pyx_PyFloat_AsDouble(__pyx_v_cy); if (unlikely((__pyx_t_19 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = ((PyObject *)((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward->__pyx_vtab)->transform(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward, __pyx_t_18, __pyx_t_19, 0)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      if (likely(PyTuple_CheckExact(__pyx_t_11))) {
        PyObject* sequence = __pyx_t_11;
        if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
          if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); 
        __Pyx_INCREF(__pyx_t_15);
        __Pyx_INCREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __Pyx_UnpackTupleError(__pyx_t_11, 2);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_DECREF(__pyx_v_cx);
      __pyx_v_cx = __pyx_t_15;
      __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_v_cy);
      __pyx_v_cy = __pyx_t_14;
      __pyx_t_14 = 0;
      goto __pyx_L15;
    }
    __pyx_L15:;

    /* "renpy/display/render.pyx":990
 *                 cx, cy = self.forward.transform(cx, cy)
 * 
 *             cf = child.main_displayables_at_point(cx, cy, layers, depth)             # <<<<<<<<<<<<<<
 *             rv.extend(cf)
 * 
 */
    __pyx_t_11 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s_18); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_14 = PyTuple_New(4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    __Pyx_INCREF(__pyx_v_cx);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_cx);
    __Pyx_GIVEREF(__pyx_v_cx);
    __Pyx_INCREF(__pyx_v_cy);
    PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_v_cy);
    __Pyx_GIVEREF(__pyx_v_cy);
    __Pyx_INCREF(__pyx_v_layers);
    PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_v_layers);
    __Pyx_GIVEREF(__pyx_v_layers);
    __Pyx_INCREF(__pyx_v_depth);
    PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_v_depth);
    __Pyx_GIVEREF(__pyx_v_depth);
    __pyx_t_15 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_v_cf);
    __pyx_v_cf = __pyx_t_15;
    __pyx_t_15 = 0;

    /* "renpy/display/render.pyx":991
 * 
 *             cf = child.main_displayables_at_point(cx, cy, layers, depth)
 *             rv.extend(cf)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
    __pyx_t_15 = PyObject_GetAttr(((PyObject *)__pyx_v_rv), __pyx_n_s__extend); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_15);
    __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_14));
    __Pyx_INCREF(__pyx_v_cf);
    PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_cf);
    __Pyx_GIVEREF(__pyx_v_cf);
    __pyx_t_11 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_L10_continue:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __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.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":996
 * 
 * 
 *     def is_opaque(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if this displayable is opaque, or False otherwise.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16is_opaque(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_16is_opaque[] = "\n        Returns true if this displayable is opaque, or False otherwise.\n        Also sets self.visible_children.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16is_opaque(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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;
  PyObject *__pyx_v_focus = NULL;
  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;
  Py_ssize_t __pyx_t_3;
  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)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("is_opaque");

  /* "renpy/display/render.pyx":1002
 *         """
 * 
 *         if self.opaque is not None:             # <<<<<<<<<<<<<<
 *             return self.opaque
 * 
 */
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __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;
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1003
 * 
 *         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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "renpy/display/render.pyx":1007
 *         # 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_2 = __Pyx_PyObject_IsTrue(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "renpy/display/render.pyx":1008
 *         # saves us from the expensive calculations require to prove it is.)
 *         if self.forward:
 *             self.opaque = False             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque = 0;

    /* "renpy/display/render.pyx":1009
 *         if self.forward:
 *             self.opaque = False
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         rv = False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":1011
 *             return False
 * 
 *         rv = False             # <<<<<<<<<<<<<<
 *         vc = [ ]
 * 
 */
  __pyx_v_rv = 0;

  /* "renpy/display/render.pyx":1012
 * 
 *         rv = False
 *         vc = [ ]             # <<<<<<<<<<<<<<
 * 
 *         for i in self.children:
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_v_vc = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1014
 *         vc = [ ]
 * 
 *         for i in self.children:             # <<<<<<<<<<<<<<
 *             child, xo, yo, focus, main = i
 * 
 */
  if (unlikely(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_1 = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
  for (;;) {
    if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++;
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1015
 * 
 *         for i in self.children:
 *             child, xo, yo, focus, main = i             # <<<<<<<<<<<<<<
 * 
 *             if xo <= 0 and yo <= 0:
 */
    if ((likely(PyTuple_CheckExact(__pyx_v_i))) || (PyList_CheckExact(__pyx_v_i))) {
      PyObject* sequence = __pyx_v_i;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
          if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
          if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_v_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_5 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 2; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 3; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 4; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L10_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_v_xo);
    __pyx_v_xo = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_v_yo);
    __pyx_v_yo = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_v_focus);
    __pyx_v_focus = __pyx_t_7;
    __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_v_main);
    __pyx_v_main = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "renpy/display/render.pyx":1017
 *             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_8 = PyObject_RichCompare(__pyx_v_xo, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_2) {
      __pyx_t_8 = PyObject_RichCompare(__pyx_v_yo, __pyx_int_0, Py_LE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_12 = __pyx_t_11;
    } else {
      __pyx_t_12 = __pyx_t_2;
    }
    if (__pyx_t_12) {

      /* "renpy/display/render.pyx":1018
 * 
 *             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 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__get_size); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
        PyObject* sequence = __pyx_t_7;
        if (likely(PyTuple_CheckExact(sequence))) {
          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
        } else {
          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
          __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        }
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        Py_ssize_t index = -1;
        __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_10 = Py_TYPE(__pyx_t_5)->tp_iternext;
        index = 0; __pyx_t_8 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_8)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_8);
        index = 1; __pyx_t_6 = __pyx_t_10(__pyx_t_5); if (unlikely(!__pyx_t_6)) goto __pyx_L12_unpacking_failed;
        __Pyx_GOTREF(__pyx_t_6);
        if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        goto __pyx_L13_unpacking_done;
        __pyx_L12_unpacking_failed:;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_L13_unpacking_done:;
      }
      __Pyx_XDECREF(__pyx_v_cw);
      __pyx_v_cw = __pyx_t_8;
      __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_v_ch);
      __pyx_v_ch = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "renpy/display/render.pyx":1019
 *             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_7 = PyNumber_Add(__pyx_v_cw, __pyx_v_xo); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_7, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!__pyx_t_12) {
        __pyx_t_8 = PyNumber_Add(__pyx_v_ch, __pyx_v_yo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_7 = PyObject_RichCompare(__pyx_t_8, __pyx_t_6, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __pyx_t_2;
      } else {
        __pyx_t_11 = __pyx_t_12;
      }
      if (__pyx_t_11) {

        /* "renpy/display/render.pyx":1020
 *                 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 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (__pyx_t_11) {

          /* "renpy/display/render.pyx":1021
 *                 if cw + xo < self.width or ch + yo < self.height:
 *                     if child.is_opaque():
 *                         vc = [ ]             # <<<<<<<<<<<<<<
 *                         rv = True
 * 
 */
          __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(((PyObject *)__pyx_t_6));
          __Pyx_DECREF(((PyObject *)__pyx_v_vc));
          __pyx_v_vc = __pyx_t_6;
          __pyx_t_6 = 0;

          /* "renpy/display/render.pyx":1022
 *                     if child.is_opaque():
 *                         vc = [ ]
 *                         rv = True             # <<<<<<<<<<<<<<
 * 
 *             vc.append(i)
 */
          __pyx_v_rv = 1;
          goto __pyx_L15;
        }
        __pyx_L15:;
        goto __pyx_L14;
      }
      __pyx_L14:;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "renpy/display/render.pyx":1024
 *                         rv = True
 * 
 *             vc.append(i)             # <<<<<<<<<<<<<<
 * 
 *         self.visible_children = vc
 */
    if (unlikely(((PyObject *)__pyx_v_vc) == Py_None)) {
      PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
    }
    __pyx_t_13 = PyList_Append(__pyx_v_vc, __pyx_v_i); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1026
 *             vc.append(i)
 * 
 *         self.visible_children = vc             # <<<<<<<<<<<<<<
 *         self.opaque = rv
 *         return rv
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_vc));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_vc));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children = __pyx_v_vc;

  /* "renpy/display/render.pyx":1027
 * 
 *         self.visible_children = vc
 *         self.opaque = rv             # <<<<<<<<<<<<<<
 *         return rv
 * 
 */
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque = __pyx_v_rv;

  /* "renpy/display/render.pyx":1028
 *         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_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __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_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":1031
 * 
 * 
 *     def is_pixel_opaque(self, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Determine if the pixel at x and y is opaque or not.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_17is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_17is_pixel_opaque[] = "\n        Determine if the pixel at x and y is opaque or not.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_17is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("is_pixel_opaque");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "is_pixel_opaque") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":1036
 *         """
 * 
 *         if x < 0 or y < 0 or x >= self.width or y >= self.height:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_2) {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
      __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_5) {
        __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_t_4, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_7 = __pyx_t_6;
      } else {
        __pyx_t_7 = __pyx_t_5;
      }
      __pyx_t_5 = __pyx_t_7;
    } else {
      __pyx_t_5 = __pyx_t_3;
    }
    __pyx_t_3 = __pyx_t_5;
  } else {
    __pyx_t_3 = __pyx_t_2;
  }
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1037
 * 
 *         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_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/display/render.pyx":1039
 *             return False
 * 
 *         if self.is_opaque():             # <<<<<<<<<<<<<<
 *             return True
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __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_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {

    /* "renpy/display/render.pyx":1040
 * 
 *         if self.is_opaque():
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         return renpy.display.draw.is_pixel_opaque(self, x, y)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "renpy/display/render.pyx":1042
 *             return True
 * 
 *         return renpy.display.draw.is_pixel_opaque(self, x, y)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__is_pixel_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __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":1045
 * 
 * 
 *     def fill(self, color):             # <<<<<<<<<<<<<<
 *         """
 *         Fills this Render with the given color.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18fill(PyObject *__pyx_v_self, PyObject *__pyx_v_color); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_18fill[] = "\n        Fills this Render with the given color.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18fill(PyObject *__pyx_v_self, PyObject *__pyx_v_color) {
  PyObject *__pyx_v_solid = NULL;
  PyObject *__pyx_v_surf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("fill");
  __Pyx_INCREF(__pyx_v_color);

  /* "renpy/display/render.pyx":1050
 *         """
 * 
 *         color = renpy.easy.color(color)             # <<<<<<<<<<<<<<
 *         solid = renpy.display.imagelike.Solid(color)
 *         surf = render(solid, self.width, self.height, 0, 0)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__easy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__color); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_v_color);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_color);
  __Pyx_GIVEREF(__pyx_v_color);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_color);
  __pyx_v_color = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1051
 * 
 *         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_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__imagelike); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__Solid); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_color);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_color);
  __Pyx_GIVEREF(__pyx_v_color);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_v_solid = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1052
 *         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(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __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":1053
 *         solid = renpy.display.imagelike.Solid(color)
 *         surf = render(solid, self.width, self.height, 0, 0)
 *         self.blit(surf, (0, 0), focus=False, main=False)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__blit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_19));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_k_tuple_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__focus), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__main), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.display.render.Render.fill", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_solid);
  __Pyx_XDECREF(__pyx_v_surf);
  __Pyx_XDECREF(__pyx_v_color);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1056
 * 
 * 
 *     def canvas(self):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a canvas object that draws to this Render.
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_19canvas(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6render_6Render_19canvas[] = "\n        Returns a canvas object that draws to this Render.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_19canvas(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_surf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("canvas");

  /* "renpy/display/render.pyx":1061
 *         """
 * 
 *         surf = renpy.display.pgrender.surface((self.width, self.height), True)             # <<<<<<<<<<<<<<
 * 
 *         mutated_surface(surf)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__surface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_surf = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1063
 *         surf = renpy.display.pgrender.surface((self.width, self.height), True)
 * 
 *         mutated_surface(surf)             # <<<<<<<<<<<<<<
 * 
 *         self.blit(surf, (0, 0))
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__mutated_surface); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/display/render.pyx":1065
 *         mutated_surface(surf)
 * 
 *         self.blit(surf, (0, 0))             # <<<<<<<<<<<<<<
 * 
 *         return Canvas(surf)
 */
  ((struct __pyx_vtabstruct_5renpy_7display_6render_Render *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->__pyx_vtab)->blit(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self), __pyx_v_surf, __pyx_k_tuple_20, 0, NULL);

  /* "renpy/display/render.pyx":1067
 *         self.blit(surf, (0, 0))
 * 
 *         return Canvas(surf)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__Canvas); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.display.render.Render.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.pxd":11
 * cdef class Render:
 * 
 *     cdef public bint mark, cache_killed             # <<<<<<<<<<<<<<
 * 
 *     cdef public float width, height
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4mark___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4mark___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->mark); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.mark.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_4mark_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_4mark_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->mark = __pyx_t_1;

  __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;
}

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->cache_killed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.cache_killed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_12cache_killed_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_12cache_killed_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->cache_killed = __pyx_t_1;

  __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":13
 *     cdef public bint mark, cache_killed
 * 
 *     cdef public float width, height             # <<<<<<<<<<<<<<
 *     cdef public object layer_name
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5width___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5width___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.width.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_5width_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_5width_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width = __pyx_t_1;

  __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;
}

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6height___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6height___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.height.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_6height_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_6height_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height = __pyx_t_1;

  __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":14
 * 
 *     cdef public float width, height
 *     cdef public object layer_name             # <<<<<<<<<<<<<<
 * 
 *     cdef public list children
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10layer_name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10layer_name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_10layer_name_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->layer_name = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":16
 *     cdef public object layer_name
 * 
 *     cdef public list children             # <<<<<<<<<<<<<<
 *     cdef public set parents
 *     cdef public list depends_on_list
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8children___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8children___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_8children_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_8children_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.children.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_8children_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_8children_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->children = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":17
 * 
 *     cdef public list children
 *     cdef public set parents             # <<<<<<<<<<<<<<
 *     cdef public list depends_on_list
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7parents___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7parents___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7parents_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7parents_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PySet_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected set, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.parents.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7parents_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7parents_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->parents = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":18
 *     cdef public list children
 *     cdef public set parents
 *     cdef public list depends_on_list             # <<<<<<<<<<<<<<
 * 
 *     cdef public int operation
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15depends_on_list___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15depends_on_list___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __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;
}

static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->depends_on_list = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":20
 *     cdef public list depends_on_list
 * 
 *     cdef public int operation             # <<<<<<<<<<<<<<
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9operation___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9operation___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.operation.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_9operation_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_9operation_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation = __pyx_t_1;

  __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":21
 * 
 *     cdef public int operation
 *     cdef public double operation_complete             # <<<<<<<<<<<<<<
 *     cdef public bint operation_alpha
 *     cdef public object operation_parameter
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_complete); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.operation_complete.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_18operation_complete_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_18operation_complete_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_complete = __pyx_t_1;

  __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":22
 *     cdef public int operation
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha             # <<<<<<<<<<<<<<
 *     cdef public object operation_parameter
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.operation_alpha.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_alpha = __pyx_t_1;

  __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":23
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha
 *     cdef public object operation_parameter             # <<<<<<<<<<<<<<
 * 
 *     cdef public Matrix2D forward, reverse
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_19operation_parameter___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_19operation_parameter___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_parameter = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":25
 *     cdef public object operation_parameter
 * 
 *     cdef public Matrix2D forward, reverse             # <<<<<<<<<<<<<<
 *     cdef public double alpha
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7forward___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7forward___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7forward_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7forward_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.forward.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7forward_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7forward_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7reverse___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7reverse___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.reverse.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7reverse_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":26
 * 
 *     cdef public Matrix2D forward, reverse
 *     cdef public double alpha             # <<<<<<<<<<<<<<
 * 
 *     cdef public list focuses
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.alpha.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_5alpha_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_5alpha_1__set__(PyObject *__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__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha = __pyx_t_1;

  __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":28
 *     cdef public double alpha
 * 
 *     cdef public list focuses             # <<<<<<<<<<<<<<
 *     cdef public list pass_focuses
 *     cdef public object draw_func
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7focuses___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7focuses___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.focuses.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7focuses_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->focuses = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":29
 * 
 *     cdef public list focuses
 *     cdef public list pass_focuses             # <<<<<<<<<<<<<<
 *     cdef public object draw_func
 *     cdef public object render_of
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12pass_focuses___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12pass_focuses___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __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;
}

static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->pass_focuses = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":30
 *     cdef public list focuses
 *     cdef public list pass_focuses
 *     cdef public object draw_func             # <<<<<<<<<<<<<<
 *     cdef public object render_of
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9draw_func___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9draw_func___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_9draw_func_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->draw_func = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":31
 *     cdef public list pass_focuses
 *     cdef public object draw_func
 *     cdef public object render_of             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint opaque
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9render_of___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9render_of___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_9render_of_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->render_of = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":33
 *     cdef public object render_of
 * 
 *     cdef public bint opaque             # <<<<<<<<<<<<<<
 *     cdef public list visible_children
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.opaque.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_6opaque_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_6opaque_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque = __pyx_t_1;

  __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":34
 * 
 *     cdef public bint opaque
 *     cdef public list visible_children             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint clipping
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16visible_children___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_16visible_children___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __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;
}

static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_16visible_children_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children));
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->visible_children = ((PyObject*)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":36
 *     cdef public list visible_children
 * 
 *     cdef public bint clipping             # <<<<<<<<<<<<<<
 * 
 *     cdef public object surface, alpha_surface, half_cache
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8clipping___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8clipping___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->clipping); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.clipping.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_8clipping_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_8clipping_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->clipping = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.clipping.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":38
 *     cdef public bint clipping
 * 
 *     cdef public object surface, alpha_surface, half_cache             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint modal
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7surface___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_7surface___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7surface_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7surface_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_7surface_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_7surface_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->surface = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_13alpha_surface___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_13alpha_surface___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha_surface = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10half_cache___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_10half_cache___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache = __pyx_v_value;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_10half_cache_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache);
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->half_cache = Py_None;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pxd":40
 *     cdef public object surface, alpha_surface, half_cache
 * 
 *     cdef public bint modal             # <<<<<<<<<<<<<<
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5modal___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5modal___get__(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__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->modal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __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.modal.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_5modal_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_5modal_1__set__(PyObject *__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__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->modal = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.modal.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/display/render.pyx":1072
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas___init__ = {__Pyx_NAMESTR("__init__"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas___init__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_surf = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__surf,0};
  __Pyx_RefNannySetupContext("__init__");
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__surf);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":1073
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 *         self.surf = surf             # <<<<<<<<<<<<<<
 * 
 *     def rect(self, color, rect, width=0):
 */
  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__surf, __pyx_v_surf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __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":1075
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_1rect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_1rect = {__Pyx_NAMESTR("rect"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_1rect, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_1rect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__color,&__pyx_n_s__rect,&__pyx_n_s__width,0};
  __Pyx_RefNannySetupContext("rect");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rect", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rect);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("rect", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "rect") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __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:;

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

    /* "renpy/display/render.pyx":1078
 * 
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.rect(self.surf,
 *                              renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1079
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,             # <<<<<<<<<<<<<<
 *                              renpy.easy.color(color),
 *                              rect,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__rect); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1080
 *             blit_lock.acquire()
 *             pygame.draw.rect(self.surf,
 *                              renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                              rect,
 *                              width)
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1082
 *                              renpy.easy.color(color),
 *                              rect,
 *                              width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_rect);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_rect);
    __Pyx_GIVEREF(__pyx_v_rect);
    __Pyx_INCREF(__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_width);
    __Pyx_GIVEREF(__pyx_v_width);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1084
 *                              width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def polygon(self, color, pointlist, width=0):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1086
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_2polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_2polygon = {__Pyx_NAMESTR("polygon"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_2polygon, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_2polygon(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_pointlist = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__color,&__pyx_n_s__pointlist,&__pyx_n_s__width,0};
  __Pyx_RefNannySetupContext("polygon");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polygon", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pointlist);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("polygon", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "polygon") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __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:;

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

    /* "renpy/display/render.pyx":1088
 *     def polygon(self, color, pointlist, width=0):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.polygon(self.surf,
 *                                 renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1089
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 pointlist,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__polygon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1090
 *             blit_lock.acquire()
 *             pygame.draw.polygon(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 pointlist,
 *                                 width)
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1092
 *                                 renpy.easy.color(color),
 *                                 pointlist,
 *                                 width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_pointlist);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_pointlist);
    __Pyx_GIVEREF(__pyx_v_pointlist);
    __Pyx_INCREF(__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_width);
    __Pyx_GIVEREF(__pyx_v_width);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1094
 *                                 width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def circle(self, color, pos, radius, width=0):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1096
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_3circle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_3circle = {__Pyx_NAMESTR("circle"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_3circle, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_3circle(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_pos = 0;
  PyObject *__pyx_v_radius = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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};
  __Pyx_RefNannySetupContext("circle");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pos);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__radius);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("circle", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "circle") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __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:;

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

    /* "renpy/display/render.pyx":1099
 * 
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.circle(self.surf,
 *                                renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1100
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,             # <<<<<<<<<<<<<<
 *                                renpy.easy.color(color),
 *                                pos,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__circle); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1101
 *             blit_lock.acquire()
 *             pygame.draw.circle(self.surf,
 *                                renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                pos,
 *                                radius,
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1104
 *                                pos,
 *                                radius,
 *                                width)             # <<<<<<<<<<<<<<
 * 
 *         finally:
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_pos);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_pos);
    __Pyx_GIVEREF(__pyx_v_pos);
    __Pyx_INCREF(__pyx_v_radius);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_radius);
    __Pyx_GIVEREF(__pyx_v_radius);
    __Pyx_INCREF(__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_width);
    __Pyx_GIVEREF(__pyx_v_width);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1107
 * 
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def ellipse(self, color, rect, width=0):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1109
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_4ellipse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_4ellipse = {__Pyx_NAMESTR("ellipse"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_4ellipse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_4ellipse(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__color,&__pyx_n_s__rect,&__pyx_n_s__width,0};
  __Pyx_RefNannySetupContext("ellipse");
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellipse", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rect);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("ellipse", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ellipse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __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:;

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

    /* "renpy/display/render.pyx":1111
 *     def ellipse(self, color, rect, width=0):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.ellipse(self.surf,
 *                                 renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1112
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 rect,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ellipse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1113
 *             blit_lock.acquire()
 *             pygame.draw.ellipse(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 rect,
 *                                 width)
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1115
 *                                 renpy.easy.color(color),
 *                                 rect,
 *                                 width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_rect);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_rect);
    __Pyx_GIVEREF(__pyx_v_rect);
    __Pyx_INCREF(__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_width);
    __Pyx_GIVEREF(__pyx_v_width);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1117
 *                                 width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1120
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_5arc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_5arc = {__Pyx_NAMESTR("arc"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_5arc, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_5arc(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_rect = 0;
  PyObject *__pyx_v_start_angle = 0;
  PyObject *__pyx_v_stop_angle = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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};
  __Pyx_RefNannySetupContext("arc");
  __pyx_self = __pyx_self;
  {
    PyObject* values[6] = {0,0,0,0,0,0};
    values[5] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rect);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_angle);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stop_angle);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("arc", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "arc") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        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_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":1121
 * 
 *     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":1122
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.arc(self.surf,
 *                             renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1123
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.arc(self.surf,             # <<<<<<<<<<<<<<
 *                             renpy.easy.color(color),
 *                             rect,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__arc); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1124
 *             blit_lock.acquire()
 *             pygame.draw.arc(self.surf,
 *                             renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                             rect,
 *                             start_angle,
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1128
 *                             start_angle,
 *                             stop_angle,
 *                             width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_rect);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_rect);
    __Pyx_GIVEREF(__pyx_v_rect);
    __Pyx_INCREF(__pyx_v_start_angle);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_start_angle);
    __Pyx_GIVEREF(__pyx_v_start_angle);
    __Pyx_INCREF(__pyx_v_stop_angle);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_stop_angle);
    __Pyx_GIVEREF(__pyx_v_stop_angle);
    __Pyx_INCREF(__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_v_width);
    __Pyx_GIVEREF(__pyx_v_width);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1130
 *                             width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 * 
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1133
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_6line(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_6line = {__Pyx_NAMESTR("line"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_6line, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_6line(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_start_pos = 0;
  PyObject *__pyx_v_end_pos = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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};
  __Pyx_RefNannySetupContext("line");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__start_pos);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__end_pos);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("line", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "line") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":1134
 * 
 *     def line(self, color, start_pos, end_pos, width=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1135
 *     def line(self, color, start_pos, end_pos, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.line(self.surf,
 *                              renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1136
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,             # <<<<<<<<<<<<<<
 *                              renpy.easy.color(color),
 *                              start_pos,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__line); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1137
 *             blit_lock.acquire()
 *             pygame.draw.line(self.surf,
 *                              renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                              start_pos,
 *                              end_pos,
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1140
 *                              start_pos,
 *                              end_pos,
 *                              width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_start_pos);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_start_pos);
    __Pyx_GIVEREF(__pyx_v_start_pos);
    __Pyx_INCREF(__pyx_v_end_pos);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_end_pos);
    __Pyx_GIVEREF(__pyx_v_end_pos);
    __Pyx_INCREF(__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_width);
    __Pyx_GIVEREF(__pyx_v_width);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1142
 *                              width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def lines(self, color, closed, pointlist, width=1):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1144
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_7lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_7lines = {__Pyx_NAMESTR("lines"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_7lines, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_7lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_closed = 0;
  PyObject *__pyx_v_pointlist = 0;
  PyObject *__pyx_v_width = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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};
  __Pyx_RefNannySetupContext("lines");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__closed);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pointlist);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("lines", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__width);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "lines") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":1145
 * 
 *     def lines(self, color, closed, pointlist, width=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1146
 *     def lines(self, color, closed, pointlist, width=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.lines(self.surf,
 *                               renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1147
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,             # <<<<<<<<<<<<<<
 *                               renpy.easy.color(color),
 *                               closed,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__lines); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1148
 *             blit_lock.acquire()
 *             pygame.draw.lines(self.surf,
 *                               renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                               closed,
 *                               pointlist,
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1151
 *                               closed,
 *                               pointlist,
 *                               width)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_closed);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_closed);
    __Pyx_GIVEREF(__pyx_v_closed);
    __Pyx_INCREF(__pyx_v_pointlist);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_pointlist);
    __Pyx_GIVEREF(__pyx_v_pointlist);
    __Pyx_INCREF(__pyx_v_width);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_width);
    __Pyx_GIVEREF(__pyx_v_width);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1153
 *                               width)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1153; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1155
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_8aaline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_8aaline = {__Pyx_NAMESTR("aaline"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_8aaline, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_8aaline(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_startpos = 0;
  PyObject *__pyx_v_endpos = 0;
  PyObject *__pyx_v_blend = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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};
  __Pyx_RefNannySetupContext("aaline");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__startpos);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__endpos);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aaline", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blend);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "aaline") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":1156
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1157
 *     def aaline(self, color, startpos, endpos, blend=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.aaline(self.surf,
 *                                renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1158
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,             # <<<<<<<<<<<<<<
 *                                renpy.easy.color(color),
 *                                startpos,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__aaline); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1159
 *             blit_lock.acquire()
 *             pygame.draw.aaline(self.surf,
 *                                renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                startpos,
 *                                endpos,
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1162
 *                                startpos,
 *                                endpos,
 *                                blend)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_startpos);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_startpos);
    __Pyx_GIVEREF(__pyx_v_startpos);
    __Pyx_INCREF(__pyx_v_endpos);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_endpos);
    __Pyx_GIVEREF(__pyx_v_endpos);
    __Pyx_INCREF(__pyx_v_blend);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_blend);
    __Pyx_GIVEREF(__pyx_v_blend);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1158; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1164
 *                                blend)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.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":1166
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_9aalines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6render_6Canvas_9aalines = {__Pyx_NAMESTR("aalines"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Canvas_9aalines, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6render_6Canvas_9aalines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_v_closed = 0;
  PyObject *__pyx_v_pointlist = 0;
  PyObject *__pyx_v_blend = 0;
  PyObject *__pyx_r = 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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 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};
  __Pyx_RefNannySetupContext("aalines");
  __pyx_self = __pyx_self;
  {
    PyObject* values[5] = {0,0,0,0,0};
    values[4] = ((PyObject *)__pyx_int_1);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__closed);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pointlist);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("aalines", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__blend);
          if (value) { values[4] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "aalines") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        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_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __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:;

  /* "renpy/display/render.pyx":1167
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):
 *         try:             # <<<<<<<<<<<<<<
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,
 */
  /*try:*/ {

    /* "renpy/display/render.pyx":1168
 *     def aalines(self, color, closed, pointlist, blend=1):
 *         try:
 *             blit_lock.acquire()             # <<<<<<<<<<<<<<
 *             pygame.draw.aalines(self.surf,
 *                                 renpy.easy.color(color),
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__acquire); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __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":1169
 *         try:
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,             # <<<<<<<<<<<<<<
 *                                 renpy.easy.color(color),
 *                                 closed,
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__draw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__aalines); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__surf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "renpy/display/render.pyx":1170
 *             blit_lock.acquire()
 *             pygame.draw.aalines(self.surf,
 *                                 renpy.easy.color(color),             # <<<<<<<<<<<<<<
 *                                 closed,
 *                                 pointlist,
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__easy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__color); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_INCREF(__pyx_v_color);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_color);
    __Pyx_GIVEREF(__pyx_v_color);
    __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

    /* "renpy/display/render.pyx":1173
 *                                 closed,
 *                                 pointlist,
 *                                 blend)             # <<<<<<<<<<<<<<
 *         finally:
 *             blit_lock.release()
 */
    __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_closed);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_closed);
    __Pyx_GIVEREF(__pyx_v_closed);
    __Pyx_INCREF(__pyx_v_pointlist);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_pointlist);
    __Pyx_GIVEREF(__pyx_v_pointlist);
    __Pyx_INCREF(__pyx_v_blend);
    PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_blend);
    __Pyx_GIVEREF(__pyx_v_blend);
    __pyx_t_2 = 0;
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; __pyx_clineno = __LINE__; goto __pyx_L7;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }

  /* "renpy/display/render.pyx":1175
 *                                 blend)
 *         finally:
 *             blit_lock.release()             # <<<<<<<<<<<<<<
 */
  /*finally:*/ {
    int __pyx_why;
    PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
    int __pyx_exc_lineno;
    __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0;
    __pyx_why = 0; goto __pyx_L8;
    __pyx_L7: {
      __pyx_why = 4;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
      __pyx_exc_lineno = __pyx_lineno;
      goto __pyx_L8;
    }
    __pyx_L8:;
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__blit_lock); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__release); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10;
    __pyx_L9_error:;
    if (__pyx_why == 4) {
      Py_XDECREF(__pyx_exc_type);
      Py_XDECREF(__pyx_exc_value);
      Py_XDECREF(__pyx_exc_tb);
    }
    goto __pyx_L1_error;
    __pyx_L10:;
    switch (__pyx_why) {
      case 4: {
        __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
        __pyx_lineno = __pyx_exc_lineno;
        __pyx_exc_type = 0;
        __pyx_exc_value = 0;
        __pyx_exc_tb = 0;
        goto __pyx_L1_error;
      }
    }
  }

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.display.render.Canvas.aalines", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D __pyx_vtable_5renpy_7display_6render_Matrix2D;

static PyObject *__pyx_tp_new_5renpy_7display_6render_Matrix2D(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_7display_6render_Matrix2D;
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6render_Matrix2D(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_xdx(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdx(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_xdy(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdy(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_ydx(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydx(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_8Matrix2D_ydy(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydy(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5renpy_7display_6render_Matrix2D[] = {
  {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pf_5renpy_7display_6render_8Matrix2D___getstate__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pf_5renpy_7display_6render_8Matrix2D_1__setstate__, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("transform"), (PyCFunction)__pyx_pf_5renpy_7display_6render_8Matrix2D_3transform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5renpy_7display_6render_Matrix2D[] = {
  {(char *)"xdx", __pyx_getprop_5renpy_7display_6render_8Matrix2D_xdx, __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdx, 0, 0},
  {(char *)"xdy", __pyx_getprop_5renpy_7display_6render_8Matrix2D_xdy, __pyx_setprop_5renpy_7display_6render_8Matrix2D_xdy, 0, 0},
  {(char *)"ydx", __pyx_getprop_5renpy_7display_6render_8Matrix2D_ydx, __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydx, 0, 0},
  {(char *)"ydy", __pyx_getprop_5renpy_7display_6render_8Matrix2D_ydy, __pyx_setprop_5renpy_7display_6render_8Matrix2D_ydy, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Matrix2D = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  __pyx_pf_5renpy_7display_6render_8Matrix2D_4__mul__, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Matrix2D = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Matrix2D = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Matrix2D = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_7display_6render_Matrix2D = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.display.render.Matrix2D"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6render_Matrix2D), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_6render_Matrix2D, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5renpy_7display_6render_8Matrix2D_5__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Matrix2D, /*tp_as_number*/
  &__pyx_tp_as_sequence_Matrix2D, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Matrix2D, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Matrix2D, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  __Pyx_DOCSTR("\n    This represents a 2d matrix that can be used to transform\n    points and things like that.\n    "), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_7display_6render_Matrix2D, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5renpy_7display_6render_Matrix2D, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5renpy_7display_6render_8Matrix2D_2__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_7display_6render_Matrix2D, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};
static struct __pyx_vtabstruct_5renpy_7display_6render_Render __pyx_vtable_5renpy_7display_6render_Render;

static PyObject *__pyx_tp_new_5renpy_7display_6render_Render(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_7display_6render_Render *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_7display_6render_Render *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_7display_6render_Render;
  p->layer_name = Py_None; Py_INCREF(Py_None);
  p->children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->parents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->depends_on_list = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->operation_parameter = Py_None; Py_INCREF(Py_None);
  p->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  p->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  p->focuses = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->pass_focuses = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->draw_func = Py_None; Py_INCREF(Py_None);
  p->render_of = Py_None; Py_INCREF(Py_None);
  p->visible_children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->surface = Py_None; Py_INCREF(Py_None);
  p->alpha_surface = Py_None; Py_INCREF(Py_None);
  p->half_cache = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6render_Render(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6render_Render *p = (struct __pyx_obj_5renpy_7display_6render_Render *)o;
  Py_XDECREF(p->layer_name);
  Py_XDECREF(((PyObject *)p->children));
  Py_XDECREF(((PyObject *)p->parents));
  Py_XDECREF(((PyObject *)p->depends_on_list));
  Py_XDECREF(p->operation_parameter);
  Py_XDECREF(((PyObject *)p->forward));
  Py_XDECREF(((PyObject *)p->reverse));
  Py_XDECREF(((PyObject *)p->focuses));
  Py_XDECREF(((PyObject *)p->pass_focuses));
  Py_XDECREF(p->draw_func);
  Py_XDECREF(p->render_of);
  Py_XDECREF(((PyObject *)p->visible_children));
  Py_XDECREF(p->surface);
  Py_XDECREF(p->alpha_surface);
  Py_XDECREF(p->half_cache);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_7display_6render_Render(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_7display_6render_Render *p = (struct __pyx_obj_5renpy_7display_6render_Render *)o;
  if (p->layer_name) {
    e = (*v)(p->layer_name, a); if (e) return e;
  }
  if (p->children) {
    e = (*v)(p->children, a); if (e) return e;
  }
  if (p->parents) {
    e = (*v)(p->parents, a); if (e) return e;
  }
  if (p->depends_on_list) {
    e = (*v)(p->depends_on_list, a); if (e) return e;
  }
  if (p->operation_parameter) {
    e = (*v)(p->operation_parameter, a); if (e) return e;
  }
  if (p->forward) {
    e = (*v)(((PyObject*)p->forward), a); if (e) return e;
  }
  if (p->reverse) {
    e = (*v)(((PyObject*)p->reverse), a); if (e) return e;
  }
  if (p->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->draw_func) {
    e = (*v)(p->draw_func, a); if (e) return e;
  }
  if (p->render_of) {
    e = (*v)(p->render_of, a); if (e) return e;
  }
  if (p->visible_children) {
    e = (*v)(p->visible_children, a); if (e) return e;
  }
  if (p->surface) {
    e = (*v)(p->surface, a); if (e) return e;
  }
  if (p->alpha_surface) {
    e = (*v)(p->alpha_surface, a); if (e) return e;
  }
  if (p->half_cache) {
    e = (*v)(p->half_cache, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_7display_6render_Render(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6render_Render *p = (struct __pyx_obj_5renpy_7display_6render_Render *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->layer_name);
  p->layer_name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->children);
  p->children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->parents);
  p->parents = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->depends_on_list);
  p->depends_on_list = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->operation_parameter);
  p->operation_parameter = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->forward);
  p->forward = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->reverse);
  p->reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->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->draw_func);
  p->draw_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->render_of);
  p->render_of = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->visible_children);
  p->visible_children = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->surface);
  p->surface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->alpha_surface);
  p->alpha_surface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->half_cache);
  p->half_cache = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_mark(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_4mark___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_mark(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_4mark_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_cache_killed(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_cache_killed(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_12cache_killed_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_width(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_5width___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_width(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_5width_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_height(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_6height___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_height(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_6height_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_layer_name(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_10layer_name___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_layer_name(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_10layer_name_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_10layer_name_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_children(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_8children___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_children(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_8children_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_8children_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_parents(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_7parents___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_parents(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_7parents_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_7parents_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_depends_on_list(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_depends_on_list(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_15depends_on_list_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_9operation___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_9operation_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation_complete(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation_complete(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_18operation_complete_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation_alpha(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation_alpha(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_operation_parameter(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_operation_parameter(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_19operation_parameter_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_forward(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_7forward___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_forward(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_7forward_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_7forward_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_reverse(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_7reverse___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_reverse(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_7reverse_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_7reverse_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_alpha(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_alpha(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_5alpha_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_focuses(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_7focuses___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_focuses(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_7focuses_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_7focuses_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_pass_focuses(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_pass_focuses(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_12pass_focuses_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_draw_func(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_9draw_func___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_draw_func(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_9draw_func_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_9draw_func_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_render_of(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_9render_of___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_render_of(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_9render_of_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_9render_of_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_opaque(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_opaque(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_6opaque_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_visible_children(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_16visible_children___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_visible_children(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_16visible_children_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_16visible_children_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_clipping(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_8clipping___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_clipping(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_8clipping_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_surface(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_7surface___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_surface(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_7surface_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_7surface_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_alpha_surface(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_alpha_surface(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_13alpha_surface_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_half_cache(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_10half_cache___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_half_cache(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_10half_cache_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6render_6Render_10half_cache_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6render_6Render_modal(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6render_6Render_5modal___get__(o);
}

static int __pyx_setprop_5renpy_7display_6render_6Render_modal(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6render_6Render_5modal_1__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_5renpy_7display_6render_Render[] = {
  {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_2__getstate__, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_3__setstate__, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("blit"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_4blit, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_4blit)},
  {__Pyx_NAMESTR("subpixel_blit"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_5subpixel_blit, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_5subpixel_blit)},
  {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_6get_size, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_6get_size)},
  {__Pyx_NAMESTR("render_to_texture"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_7render_to_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_7render_to_texture)},
  {__Pyx_NAMESTR("subsurface"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_8subsurface, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_8subsurface)},
  {__Pyx_NAMESTR("depends_on"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_9depends_on, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_9depends_on)},
  {__Pyx_NAMESTR("kill_cache"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_10kill_cache, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_10kill_cache)},
  {__Pyx_NAMESTR("kill"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_11kill, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_11kill)},
  {__Pyx_NAMESTR("add_focus"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_12add_focus, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_12add_focus)},
  {__Pyx_NAMESTR("take_focuses"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_13take_focuses, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_13take_focuses)},
  {__Pyx_NAMESTR("focus_at_point"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_14focus_at_point, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_14focus_at_point)},
  {__Pyx_NAMESTR("main_displayables_at_point"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_15main_displayables_at_point, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_15main_displayables_at_point)},
  {__Pyx_NAMESTR("is_opaque"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_16is_opaque, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_16is_opaque)},
  {__Pyx_NAMESTR("is_pixel_opaque"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_17is_pixel_opaque, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_17is_pixel_opaque)},
  {__Pyx_NAMESTR("fill"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_18fill, METH_O, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_18fill)},
  {__Pyx_NAMESTR("canvas"), (PyCFunction)__pyx_pf_5renpy_7display_6render_6Render_19canvas, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_6Render_19canvas)},
  {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, 0, 0},
  {(char *)"cache_killed", __pyx_getprop_5renpy_7display_6render_6Render_cache_killed, __pyx_setprop_5renpy_7display_6render_6Render_cache_killed, 0, 0},
  {(char *)"width", __pyx_getprop_5renpy_7display_6render_6Render_width, __pyx_setprop_5renpy_7display_6render_6Render_width, 0, 0},
  {(char *)"height", __pyx_getprop_5renpy_7display_6render_6Render_height, __pyx_setprop_5renpy_7display_6render_6Render_height, 0, 0},
  {(char *)"layer_name", __pyx_getprop_5renpy_7display_6render_6Render_layer_name, __pyx_setprop_5renpy_7display_6render_6Render_layer_name, 0, 0},
  {(char *)"children", __pyx_getprop_5renpy_7display_6render_6Render_children, __pyx_setprop_5renpy_7display_6render_6Render_children, 0, 0},
  {(char *)"parents", __pyx_getprop_5renpy_7display_6render_6Render_parents, __pyx_setprop_5renpy_7display_6render_6Render_parents, 0, 0},
  {(char *)"depends_on_list", __pyx_getprop_5renpy_7display_6render_6Render_depends_on_list, __pyx_setprop_5renpy_7display_6render_6Render_depends_on_list, 0, 0},
  {(char *)"operation", __pyx_getprop_5renpy_7display_6render_6Render_operation, __pyx_setprop_5renpy_7display_6render_6Render_operation, 0, 0},
  {(char *)"operation_complete", __pyx_getprop_5renpy_7display_6render_6Render_operation_complete, __pyx_setprop_5renpy_7display_6render_6Render_operation_complete, 0, 0},
  {(char *)"operation_alpha", __pyx_getprop_5renpy_7display_6render_6Render_operation_alpha, __pyx_setprop_5renpy_7display_6render_6Render_operation_alpha, 0, 0},
  {(char *)"operation_parameter", __pyx_getprop_5renpy_7display_6render_6Render_operation_parameter, __pyx_setprop_5renpy_7display_6render_6Render_operation_parameter, 0, 0},
  {(char *)"forward", __pyx_getprop_5renpy_7display_6render_6Render_forward, __pyx_setprop_5renpy_7display_6render_6Render_forward, 0, 0},
  {(char *)"reverse", __pyx_getprop_5renpy_7display_6render_6Render_reverse, __pyx_setprop_5renpy_7display_6render_6Render_reverse, 0, 0},
  {(char *)"alpha", __pyx_getprop_5renpy_7display_6render_6Render_alpha, __pyx_setprop_5renpy_7display_6render_6Render_alpha, 0, 0},
  {(char *)"focuses", __pyx_getprop_5renpy_7display_6render_6Render_focuses, __pyx_setprop_5renpy_7display_6render_6Render_focuses, 0, 0},
  {(char *)"pass_focuses", __pyx_getprop_5renpy_7display_6render_6Render_pass_focuses, __pyx_setprop_5renpy_7display_6render_6Render_pass_focuses, 0, 0},
  {(char *)"draw_func", __pyx_getprop_5renpy_7display_6render_6Render_draw_func, __pyx_setprop_5renpy_7display_6render_6Render_draw_func, 0, 0},
  {(char *)"render_of", __pyx_getprop_5renpy_7display_6render_6Render_render_of, __pyx_setprop_5renpy_7display_6render_6Render_render_of, 0, 0},
  {(char *)"opaque", __pyx_getprop_5renpy_7display_6render_6Render_opaque, __pyx_setprop_5renpy_7display_6render_6Render_opaque, 0, 0},
  {(char *)"visible_children", __pyx_getprop_5renpy_7display_6render_6Render_visible_children, __pyx_setprop_5renpy_7display_6render_6Render_visible_children, 0, 0},
  {(char *)"clipping", __pyx_getprop_5renpy_7display_6render_6Render_clipping, __pyx_setprop_5renpy_7display_6render_6Render_clipping, 0, 0},
  {(char *)"surface", __pyx_getprop_5renpy_7display_6render_6Render_surface, __pyx_setprop_5renpy_7display_6render_6Render_surface, 0, 0},
  {(char *)"alpha_surface", __pyx_getprop_5renpy_7display_6render_6Render_alpha_surface, __pyx_setprop_5renpy_7display_6render_6Render_alpha_surface, 0, 0},
  {(char *)"half_cache", __pyx_getprop_5renpy_7display_6render_6Render_half_cache, __pyx_setprop_5renpy_7display_6render_6Render_half_cache, 0, 0},
  {(char *)"modal", __pyx_getprop_5renpy_7display_6render_6Render_modal, __pyx_setprop_5renpy_7display_6render_6Render_modal, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Render = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Render = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Render = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Render = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_7display_6render_Render = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.display.render.Render"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6render_Render), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_6render_Render, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  __pyx_pf_5renpy_7display_6render_6Render_1__repr__, /*tp_repr*/
  &__pyx_tp_as_number_Render, /*tp_as_number*/
  &__pyx_tp_as_sequence_Render, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Render, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Render, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|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_pf_5renpy_7display_6render_6Render___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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("render"), (PyCFunction)__pyx_pf_5renpy_7display_6render_2render, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6render_2render)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("render"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_n_s__BLIT, __pyx_k__BLIT, sizeof(__pyx_k__BLIT), 0, 0, 1, 1},
  {&__pyx_n_s__Canvas, __pyx_k__Canvas, sizeof(__pyx_k__Canvas), 0, 0, 1, 1},
  {&__pyx_n_s__Condition, __pyx_k__Condition, sizeof(__pyx_k__Condition), 0, 0, 1, 1},
  {&__pyx_n_s__DISSOLVE, __pyx_k__DISSOLVE, sizeof(__pyx_k__DISSOLVE), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 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_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__Solid, __pyx_k__Solid, sizeof(__pyx_k__Solid), 0, 0, 1, 1},
  {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__aaline, __pyx_k__aaline, sizeof(__pyx_k__aaline), 0, 0, 1, 1},
  {&__pyx_n_s__aalines, __pyx_k__aalines, sizeof(__pyx_k__aalines), 0, 0, 1, 1},
  {&__pyx_n_s__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__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 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__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__check_at_shutdown, __pyx_k__check_at_shutdown, sizeof(__pyx_k__check_at_shutdown), 0, 0, 1, 1},
  {&__pyx_n_s__circle, __pyx_k__circle, sizeof(__pyx_k__circle), 0, 0, 1, 1},
  {&__pyx_n_s__clear, __pyx_k__clear, sizeof(__pyx_k__clear), 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__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__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1},
  {&__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__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__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_n_s__endpos, __pyx_k__endpos, sizeof(__pyx_k__endpos), 0, 0, 1, 1},
  {&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 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__frame_time, __pyx_k__frame_time, sizeof(__pyx_k__frame_time), 0, 0, 1, 1},
  {&__pyx_n_s__free_memory, __pyx_k__free_memory, sizeof(__pyx_k__free_memory), 0, 0, 1, 1},
  {&__pyx_n_s__game, __pyx_k__game, sizeof(__pyx_k__game), 0, 0, 1, 1},
  {&__pyx_n_s__gc, __pyx_k__gc, sizeof(__pyx_k__gc), 0, 0, 1, 1},
  {&__pyx_n_s__get_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_time, __pyx_k__get_time, sizeof(__pyx_k__get_time), 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_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
  {&__pyx_n_s__imagelike, __pyx_k__imagelike, sizeof(__pyx_k__imagelike), 0, 0, 1, 1},
  {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 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__kill_cache, __pyx_k__kill_cache, sizeof(__pyx_k__kill_cache), 0, 0, 1, 1},
  {&__pyx_n_s__layer_name, __pyx_k__layer_name, sizeof(__pyx_k__layer_name), 0, 0, 1, 1},
  {&__pyx_n_s__layers, __pyx_k__layers, sizeof(__pyx_k__layers), 0, 0, 1, 1},
  {&__pyx_n_s__line, __pyx_k__line, sizeof(__pyx_k__line), 0, 0, 1, 1},
  {&__pyx_n_s__lines, __pyx_k__lines, sizeof(__pyx_k__lines), 0, 0, 1, 1},
  {&__pyx_n_s__main, __pyx_k__main, sizeof(__pyx_k__main), 0, 0, 1, 1},
  {&__pyx_n_s__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__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__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
  {&__pyx_n_s__opaque, __pyx_k__opaque, sizeof(__pyx_k__opaque), 0, 0, 1, 1},
  {&__pyx_n_s__parents, __pyx_k__parents, sizeof(__pyx_k__parents), 0, 0, 1, 1},
  {&__pyx_n_s__pgrender, __pyx_k__pgrender, sizeof(__pyx_k__pgrender), 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__process_redraws, __pyx_k__process_redraws, sizeof(__pyx_k__process_redraws), 0, 0, 1, 1},
  {&__pyx_n_s__pygame, __pyx_k__pygame, sizeof(__pyx_k__pygame), 0, 0, 1, 1},
  {&__pyx_n_s__pygame_surface, __pyx_k__pygame_surface, sizeof(__pyx_k__pygame_surface), 0, 0, 1, 1},
  {&__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__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_cache, __pyx_k__render_cache, sizeof(__pyx_k__render_cache), 0, 0, 1, 1},
  {&__pyx_n_s__render_of, __pyx_k__render_of, sizeof(__pyx_k__render_of), 0, 0, 1, 1},
  {&__pyx_n_s__render_screen, __pyx_k__render_screen, sizeof(__pyx_k__render_screen), 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__renpy, __pyx_k__renpy, sizeof(__pyx_k__renpy), 0, 0, 1, 1},
  {&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1},
  {&__pyx_n_s__root, __pyx_k__root, sizeof(__pyx_k__root), 0, 0, 1, 1},
  {&__pyx_n_s__screen_render, __pyx_k__screen_render, sizeof(__pyx_k__screen_render), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 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__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_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_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__sx0, __pyx_k__sx0, sizeof(__pyx_k__sx0), 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__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__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__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__xdx, __pyx_k__xdx, sizeof(__pyx_k__xdx), 0, 0, 1, 1},
  {&__pyx_n_s__xdy, __pyx_k__xdy, sizeof(__pyx_k__xdy), 0, 0, 1, 1},
  {&__pyx_n_s__xmaximum, __pyx_k__xmaximum, sizeof(__pyx_k__xmaximum), 0, 0, 1, 1},
  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
  {&__pyx_n_s__ydx, __pyx_k__ydx, sizeof(__pyx_k__ydx), 0, 0, 1, 1},
  {&__pyx_n_s__ydy, __pyx_k__ydy, sizeof(__pyx_k__ydy), 0, 0, 1, 1},
  {&__pyx_n_s__ymaximum, __pyx_k__ymaximum, sizeof(__pyx_k__ymaximum), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");

  /* "renpy/display/render.pyx":557
 *     def __getstate__(self): #@DuplicatedSignature
 *         if renpy.config.developer:
 *             raise Exception("Can't pickle a Render.")             # <<<<<<<<<<<<<<
 *         else:
 *             return { }
 */
  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));

  /* "renpy/display/render.pyx":578
 * 
 *         if source is self:
 *             raise Exception("Blitting to self.")             # <<<<<<<<<<<<<<
 * 
 *         xo = int(xo)
 */
  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "renpy/display/render.pyx":776
 * 
 *         if source is self:
 *             raise Exception("Render depends on itself.")             # <<<<<<<<<<<<<<
 * 
 *         self.depends_on_list.append(source)
 */
  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));

  /* "renpy/display/render.pyx":1053
 *         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_k_tuple_19 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "renpy/display/render.pyx":1065
 *         mutated_surface(surf)
 * 
 *         self.blit(surf, (0, 0))             # <<<<<<<<<<<<<<
 * 
 *         return Canvas(surf)
 */
  __pyx_k_tuple_20 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_20, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20));

  /* "renpy/display/render.pyx":311
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)
 * 
 * IDENTITY = Matrix2D(1, 0, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * def take_focuses(focuses):
 */
  __pyx_k_tuple_22 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22));
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_22, 3, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22));
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  #if PY_VERSION_HEX < 0x02040000
  if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initrender(void); /*proto*/
PyMODINIT_FUNC initrender(void)
#else
PyMODINIT_FUNC PyInit_render(void); /*proto*/
PyMODINIT_FUNC PyInit_render(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_render(void)");
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __pyx_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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 PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("render"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_renpy__display__render) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  __pyx_v_5renpy_7display_6render_live_renders = ((PyObject*)Py_None); Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  if (__Pyx_ExportFunction("render", (void (*)(void))__pyx_f_5renpy_7display_6render_render, "PyObject *(PyObject *, PyObject *, PyObject *, double, double, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Type init code ---*/
  __pyx_vtabptr_5renpy_7display_6render_Matrix2D = &__pyx_vtable_5renpy_7display_6render_Matrix2D;
  __pyx_vtable_5renpy_7display_6render_Matrix2D.transform = (PyObject *(*)(struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, int __pyx_skip_dispatch))__pyx_f_5renpy_7display_6render_8Matrix2D_transform;
  if (PyType_Ready(&__pyx_type_5renpy_7display_6render_Matrix2D) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5renpy_7display_6render_Matrix2D.tp_dict, __pyx_vtabptr_5renpy_7display_6render_Matrix2D) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Matrix2D", (PyObject *)&__pyx_type_5renpy_7display_6render_Matrix2D) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_6render_Matrix2D = &__pyx_type_5renpy_7display_6render_Matrix2D;
  __pyx_vtabptr_5renpy_7display_6render_Render = &__pyx_vtable_5renpy_7display_6render_Render;
  __pyx_vtable_5renpy_7display_6render_Render.blit = (int (*)(struct __pyx_obj_5renpy_7display_6render_Render *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_blit *__pyx_optional_args))__pyx_f_5renpy_7display_6render_6Render_blit;
  __pyx_vtable_5renpy_7display_6render_Render.subpixel_blit = (int (*)(struct __pyx_obj_5renpy_7display_6render_Render *, PyObject *, PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit *__pyx_optional_args))__pyx_f_5renpy_7display_6render_6Render_subpixel_blit;
  if (PyType_Ready(&__pyx_type_5renpy_7display_6render_Render) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  {
    PyObject *wrapper = __Pyx_GetAttrString((PyObject *)&__pyx_type_5renpy_7display_6render_Render, "__init__"); if (unlikely(!wrapper)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __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__;
    }
  }
  if (__Pyx_SetVtable(__pyx_type_5renpy_7display_6render_Render.tp_dict, __pyx_vtabptr_5renpy_7display_6render_Render) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Render", (PyObject *)&__pyx_type_5renpy_7display_6render_Render) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_6render_Render = &__pyx_type_5renpy_7display_6render_Render;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "renpy/display/render.pyx":23
 * # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 * import collections             # <<<<<<<<<<<<<<
 * import pygame
 * import threading
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__collections), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__collections, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":24
 * 
 * import collections
 * import pygame             # <<<<<<<<<<<<<<
 * import threading
 * import renpy
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__pygame), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pygame, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":25
 * import collections
 * import pygame
 * import threading             # <<<<<<<<<<<<<<
 * import renpy
 * import gc
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__threading), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__threading, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":26
 * import pygame
 * import threading
 * import renpy             # <<<<<<<<<<<<<<
 * import gc
 * 
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__renpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__renpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":27
 * import threading
 * import renpy
 * import gc             # <<<<<<<<<<<<<<
 * 
 * # We grab the blit lock each time it is necessary to blit
 */
  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__gc), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":32
 * # something. This allows call to the pygame.transform functions to
 * # disable blitting, should it prove necessary.
 * blit_lock = threading.Condition()             # <<<<<<<<<<<<<<
 * 
 * # This is a dictionary containing all the renders that we know of. It's a
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__threading); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__Condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blit_lock, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":37
 * # map from displayable to dictionaries containing the render of that
 * # displayable.
 * render_cache = collections.defaultdict(dict)             # <<<<<<<<<<<<<<
 * 
 * # The queue of redraws. A list of (time, displayable) pairs.
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__collections); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__defaultdict); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((PyObject*)(&PyDict_Type))));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)(&PyDict_Type))));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)(&PyDict_Type))));
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__render_cache, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":40
 * 
 * # The queue of redraws. A list of (time, displayable) pairs.
 * redraw_queue = [ ]             # <<<<<<<<<<<<<<
 * 
 * # The render returned from render_screen.
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__redraw_queue, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":43
 * 
 * # The render returned from render_screen.
 * screen_render = None             # <<<<<<<<<<<<<<
 * 
 * # A list of renders the system knows about, and thinks are still alive.
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__screen_render, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":47
 * # 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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_XGOTREF(((PyObject *)__pyx_v_5renpy_7display_6render_live_renders));
  __Pyx_DECREF(((PyObject *)__pyx_v_5renpy_7display_6render_live_renders));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_3));
  __pyx_v_5renpy_7display_6render_live_renders = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":51
 * # A copy of renpy.display.interface.frame_time, for speed reasons.
 * cdef double frame_time
 * frame_time = 0             # <<<<<<<<<<<<<<
 * 
 * def free_memory():
 */
  __pyx_v_5renpy_7display_6render_frame_time = 0.0;

  /* "renpy/display/render.pyx":53
 * frame_time = 0
 * 
 * def free_memory():             # <<<<<<<<<<<<<<
 *     """
 *     Frees memory used by the render system.
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_free_memory, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__free_memory, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":69
 * 
 * 
 * def check_at_shutdown():             # <<<<<<<<<<<<<<
 *     """
 *     This is called at shutdown time to check that everything went okay.
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_1check_at_shutdown, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__check_at_shutdown, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":185
 * # to occur. It's automatically cleared to False at the end of each
 * # redraw.
 * invalidated = False             # <<<<<<<<<<<<<<
 * 
 * def invalidate(d):
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__invalidated, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":187
 * invalidated = False
 * 
 * def invalidate(d):             # <<<<<<<<<<<<<<
 *     """
 *     Removes d from the render cache. If we're not in a redraw, triggers
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_3invalidate, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__invalidate, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":202
 * 
 * 
 * def process_redraws():             # <<<<<<<<<<<<<<
 *     """
 *     Called to determine if any redraws are pending. Returns true if we
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_4process_redraws, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__process_redraws, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":248
 * 
 * 
 * def redraw_time():             # <<<<<<<<<<<<<<
 *     """
 *     Returns the time at which the next redraw is scheduled.
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_5redraw_time, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__redraw_time, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":259
 * 
 * 
 * def redraw(d, when):             # <<<<<<<<<<<<<<
 *     """
 *     :doc: udd_utility
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_6redraw, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__redraw, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":311
 *         return "Matrix2D(xdx=%f, xdy=%f, ydx=%f, ydy=%f)" % (self.xdx, self.xdy, self.ydx, self.ydy)
 * 
 * IDENTITY = Matrix2D(1, 0, 0, 1)             # <<<<<<<<<<<<<<
 * 
 * def take_focuses(focuses):
 */
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Matrix2D)), ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IDENTITY, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":313
 * IDENTITY = Matrix2D(1, 0, 0, 1)
 * 
 * def take_focuses(focuses):             # <<<<<<<<<<<<<<
 *     """
 *     Adds a list of rectangular focus regions to the focuses list.
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_7take_focuses, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__take_focuses, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":324
 * # The result of focus_at_point for a modal render. This overrides any
 * # specific focus from below us.
 * Modal = object()             # <<<<<<<<<<<<<<
 * 
 * def focus_at_point(x, y):
 */
  __pyx_t_3 = PyObject_Call(__pyx_builtin_object, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Modal, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":326
 * Modal = object()
 * 
 * def focus_at_point(x, y):             # <<<<<<<<<<<<<<
 *     """
 *     Returns a focus object corresponding to the uppermost displayable
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_8focus_at_point, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__focus_at_point, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":343
 * 
 * 
 * def mutated_surface(surf):             # <<<<<<<<<<<<<<
 *     """
 *     Called to indicate that the given surface has changed.
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_9mutated_surface, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mutated_surface, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":351
 * 
 * 
 * def render_screen(root, width, height):             # <<<<<<<<<<<<<<
 *     """
 *     Renders `root` (a displayable) as the root of a screen with the given
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_10render_screen, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__render_screen, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":375
 *     return rv
 * 
 * def mark_sweep():             # <<<<<<<<<<<<<<
 *     """
 *     This performs mark-and-sweep garbage collection on the live_renders
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_11mark_sweep, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mark_sweep, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":412
 *     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_3 = PyCFunction_NewEx(&__pyx_mdef_5renpy_7display_6render_12compute_subline, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__compute_subline, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":447
 * 
 * # Possible operations that can be done as part of a render.
 * BLIT = 0             # <<<<<<<<<<<<<<
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLIT, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":448
 * # Possible operations that can be done as part of a render.
 * BLIT = 0
 * DISSOLVE = 1             # <<<<<<<<<<<<<<
 * IMAGEDISSOLVE = 2
 * PIXELLATE = 3
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DISSOLVE, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":449
 * BLIT = 0
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2             # <<<<<<<<<<<<<<
 * PIXELLATE = 3
 * 
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__IMAGEDISSOLVE, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":450
 * DISSOLVE = 1
 * IMAGEDISSOLVE = 2
 * PIXELLATE = 3             # <<<<<<<<<<<<<<
 * 
 * cdef class Render:
 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__PIXELLATE, __pyx_int_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/display/render.pyx":454
 * cdef class Render:
 * 
 *     def __init__(Render self, float width, float height, draw_func=None, layer_name=None, bint opaque=None): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         """
 *         Creates a new render corresponding to the given widget with
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(Py_None); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_k_3 = __pyx_t_4;

  /* "renpy/display/render.pyx":564
 *         return
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_7 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_8 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":594
 *         return 0
 * 
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=True, object main=True, object index=None):             # <<<<<<<<<<<<<<
 *         """
 *         Blits `source` (a Render or Surface) to this Render, offset by
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_11 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_12 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":631
 * 
 * 
 *     def render_to_texture(self, alpha=True):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a texture constructed from this render. This may return
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_13 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":680
 *         return rv
 * 
 *     pygame_surface = render_to_texture             # <<<<<<<<<<<<<<
 * 
 *     def subsurface(self, rect, focus=False):
 */
  __pyx_t_3 = __Pyx_GetName((PyObject *)__pyx_ptype_5renpy_7display_6render_Render, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem((PyObject *)__pyx_ptype_5renpy_7display_6render_Render->tp_dict, __pyx_n_s__pygame_surface, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  PyType_Modified(__pyx_ptype_5renpy_7display_6render_Render);

  /* "renpy/display/render.pyx":682
 *     pygame_surface = render_to_texture
 * 
 *     def subsurface(self, rect, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Returns a subsurface of this render. If `focus` is true, then
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_14 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":768
 * 
 * 
 *     def depends_on(self, source, focus=False):             # <<<<<<<<<<<<<<
 *         """
 *         Used to indicate that this render depends on another
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_15 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1070
 * 
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "renpy/display/render.pyx":1072
 * class Canvas(object):
 * 
 *     def __init__(self, surf): #@DuplicatedSignature             # <<<<<<<<<<<<<<
 *         self.surf = surf
 * 
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas___init__, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s____init__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1075
 *         self.surf = surf
 * 
 *     def rect(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_1rect, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__rect, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1086
 *             blit_lock.release()
 * 
 *     def polygon(self, color, pointlist, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_2polygon, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__polygon, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1096
 *             blit_lock.release()
 * 
 *     def circle(self, color, pos, radius, width=0):             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_3circle, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__circle, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1109
 *             blit_lock.release()
 * 
 *     def ellipse(self, color, rect, width=0):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_4ellipse, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__ellipse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1120
 * 
 * 
 *     def arc(self, color, rect, start_angle, stop_angle, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_5arc, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__arc, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1133
 * 
 * 
 *     def line(self, color, start_pos, end_pos, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_6line, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__line, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1144
 *             blit_lock.release()
 * 
 *     def lines(self, color, closed, pointlist, width=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_7lines, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__lines, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1155
 *             blit_lock.release()
 * 
 *     def aaline(self, color, startpos, endpos, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_8aaline, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__aaline, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1166
 *             blit_lock.release()
 * 
 *     def aalines(self, color, closed, pointlist, blend=1):             # <<<<<<<<<<<<<<
 *         try:
 *             blit_lock.acquire()
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_7display_6render_6Canvas_9aalines, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__aalines, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/display/render.pyx":1070
 * 
 * 
 * class Canvas(object):             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, surf): #@DuplicatedSignature
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  __pyx_t_2 = __Pyx_CreateClass(((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3), __pyx_n_s__Canvas, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Canvas, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "renpy/display/render.pyx":1
 * #cython: profile=False             # <<<<<<<<<<<<<<
 * # Copyright 2004-2012 Tom Rothamel <pytom@bishoujo.us>
 * #
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    __Pyx_AddTraceback("init renpy.display.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init renpy.display.render");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */

#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    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_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            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;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    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)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        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;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

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,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

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_AS_STRING(kw_name));
        #endif
}

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;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else if (PyErr_Occurred()) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
}


static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

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

static double __Pyx__PyObject_AsDouble(PyObject* obj) {
    PyObject* float_value;
    if (Py_TYPE(obj)->tp_as_number && Py_TYPE(obj)->tp_as_number->nb_float) {
        return PyFloat_AsDouble(obj);
    } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
#if PY_MAJOR_VERSION >= 3
        float_value = PyFloat_FromString(obj);
#else
        float_value = PyFloat_FromString(obj, 0);
#endif
    } else {
        PyObject* args = PyTuple_New(1);
        if (unlikely(!args)) goto bad;
        PyTuple_SET_ITEM(args, 0, obj);
        float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
        PyTuple_SET_ITEM(args, 0, 0);
        Py_DECREF(args);
    }
    if (likely(float_value)) {
        double value = PyFloat_AS_DOUBLE(float_value);
        Py_DECREF(float_value);
        return value;
    }
bad:
    return (double)-1;
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    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_VERSION_HEX >= 0x02050000
    {
        PyObject *py_level = PyInt_FromLong(level);
        if (!py_level)
            goto bad;
        module = PyObject_CallFunctionObjArgs(py_import,
            name, global_dict, empty_dict, list, py_level, NULL);
        Py_DECREF(py_level);
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
    /* Default metaclass */
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = PyObject_GetAttrString(base, (char *)"__class__");
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;

    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
        return NULL;

    /* Python2 __metaclass__ */
    metaclass = PyDict_GetItemString(dict, "__metaclass__");
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}


static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
    __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
    if (op == NULL)
        return NULL;
    op->func.m_ml = ml;
    Py_XINCREF(self);
    op->func.m_self = self;
    Py_XINCREF(module);
    op->func.m_module = module;
    PyObject_GC_Track(op);
    return (PyObject *)op;
}

static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
    PyObject_GC_UnTrack(m);
    Py_XDECREF(m->func.m_self);
    Py_XDECREF(m->func.m_module);
    PyObject_GC_Del(m);
}

static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
    if (obj == Py_None)
            obj = NULL;
    return PyMethod_New(func, obj, type);
}

static int __pyx_binding_PyCFunctionType_init(void) {
    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
        return -1;
    }
    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
    return 0;

}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #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);
    }
}

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);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

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 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    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;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #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_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __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,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

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  /* Python 3+ has unicode identifiers */
        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;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

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 PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  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 = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
