/* Generated by Cython 0.19.2 on Tue Apr  8 11:46:27 2014 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#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
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#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 CYTHON_FORMAT_SSIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
                                (PyErr_Format(PyExc_TypeError, \
                                              "expected index value, got %.200s", Py_TYPE(o)->tp_name), \
                                 (PyObject*)0))
  #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \
                                  !PyComplex_Check(o))
  #define PyIndex_Check __Pyx_PyIndex_Check
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
  #define CYTHON_FORMAT_SSIZE_T "z"
  #define __Pyx_PyIndex_Check PyIndex_Check
#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)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#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_VERSION_HEX < 0x02060000
  #define Py_TPFLAGS_HAVE_VERSION_TAG 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#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_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \
                                         PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type)
#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) || (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 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
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#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

#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__gl__gldraw
#define __PYX_HAVE_API__renpy__gl__gldraw
#include "string.h"
#include "stdlib.h"
#include "pygame/pygame.h"
#include "glcompat.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromUString(s)  __Pyx_PyObject_FromString((char*)s)
#define __Pyx_PyBytes_FromUString(s)   __Pyx_PyBytes_FromString((char*)s)
#define __Pyx_PyStr_FromUString(s)     __Pyx_PyStr_FromString((char*)s)
#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return u_end - u - 1;
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_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*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params() {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        const char* default_encoding_c = PyBytes_AS_STRING(default_encoding);
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (ascii_chars_u == NULL) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
    }
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return 0;
bad:
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params() {
    PyObject* sys = NULL;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (sys == NULL) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    if (default_encoding == NULL) goto bad;
    default_encoding_c = PyBytes_AS_STRING(default_encoding);
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(sys);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(sys);
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


#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_d;
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[] = {
  "gldraw.pyx",
  "gldraw.pxd",
  "gl.pxd",
  "render.pxd",
  "gltexture.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw;
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init;
struct __pyx_obj_5renpy_7display_6render_Render;
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture;
struct __pyx_obj_5renpy_7display_6render_Matrix2D;
struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid;
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half;
struct __pyx_obj_5renpy_2gl_6gldraw_Environ;
struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore;
struct __pyx_opt_args_5renpy_7display_6render_6Render_blit;
struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit;

/* "renpy/display/render.pxd":64
 *     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":65
 * 
 *     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/gl/gldraw.pxd":26
 * cdef class Environ
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     cdef bint did_init
 */
struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *__pyx_vtab;
  int did_init;
  struct __pyx_obj_5renpy_2gl_6gldraw_Environ *environ;
  PyObject *rtt;
  PyObject *window;
  PyObject *virtual_size;
  PyObject *physical_size;
  PyObject *virtual_box;
  PyObject *physical_box;
  PyObject *mouse_old_visible;
  PyObject *mouse_info;
  PyObject *texture_cache;
  double last_redraw_time;
  double redraw_period;
  PyObject *info;
  PyObject *old_fullscreen;
  PyObject *fullscreen_surface;
  PyObject *display_info;
  double upscale_factor;
  PyObject *clip_cache;
  int fast_dissolve;
  int always_opaque;
  int allow_fixed;
  PyObject *default_clip;
  PyObject *clip_rtt_box;
};


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


/* "renpy/display/render.pxd":30
 *     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;
  double over;
  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/gl/gldraw.pyx":884
 *         return 0
 * 
 *     def render_to_texture(self_, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         cdef GLDraw self = self_
 */
struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture {
  PyObject_HEAD
  PyObject *__pyx_v_alpha;
  PyObject *__pyx_v_reverse;
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self;
  PyObject *__pyx_v_what;
};


/* "renpy/display/render.pxd":22
 * # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 * cdef class Matrix2D:             # <<<<<<<<<<<<<<
 *     cdef public double xdx
 *     cdef public double xdy
 */
struct __pyx_obj_5renpy_7display_6render_Matrix2D {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *__pyx_vtab;
  double xdx;
  double xdy;
  double ydx;
  double ydy;
};


/* "gltexture.pxd":49
 *     cpdef int allocate(TextureCore)
 * 
 * cdef class TextureGrid:             # <<<<<<<<<<<<<<
 * 
 *    cdef public int width
 */
struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureGrid *__pyx_vtab;
  int width;
  int height;
  PyObject *rows;
  PyObject *columns;
  PyObject *tiles;
  struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *half_cache;
};


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


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


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



/* "gltexture.pxd":49
 *     cpdef int allocate(TextureCore)
 * 
 * cdef class TextureGrid:             # <<<<<<<<<<<<<<
 * 
 *    cdef public int width
 */

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


/* "renpy/display/render.pxd":30
 *     cpdef tuple transform(Matrix2D self, double x, double y)
 * 
 * cdef class Render:             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint mark, cache_killed
 */

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


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

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


/* "renpy/display/render.pxd":22
 * # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * 
 * cdef class Matrix2D:             # <<<<<<<<<<<<<<
 *     cdef public double xdx
 *     cdef public double xdy
 */

struct __pyx_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/gl/gldraw.pyx":76
 * IDENTITY = renpy.display.render.IDENTITY
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, allow_fixed=True):
 */

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


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

struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ {
  void (*blit)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *);
  void (*blend)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double);
  void (*imageblend)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, int);
  void (*set_vertex)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, float *);
  void (*set_texture)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, float *);
  void (*set_color)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, float, float, float, float);
  void (*set_clip)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, PyObject *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *);
  void (*unset_clip)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *);
  void (*ortho)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, double, double, double, double, double);
  void (*viewport)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int, int, int);
};
static struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *__pyx_vtabptr_5renpy_2gl_6gldraw_Environ;
#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;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

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

static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*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 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 CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

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

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

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

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

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

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

#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) */
#endif /* < Py2.5  */

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

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

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

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

#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \
    (((size) <= sizeof(Py_ssize_t)) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \
    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

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_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename); /*proto*/

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

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

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

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

#include <string.h>

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

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

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

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

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

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

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_GLint(GLint);

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_GLenum(GLenum);

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 int __Pyx_check_binary_version(void);

#if !defined(__Pyx_PyIdentifier_FromString)
#if PY_MAJOR_VERSION < 3
  #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
#else
  #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
#endif
#endif

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

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

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

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

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *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;

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

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

/* Module declarations from 'pygame' */

/* Module declarations from 'renpy.gl.gl' */
static CYTHON_INLINE PyObject *__pyx_f_5renpy_2gl_2gl_gl_check(PyObject *); /*proto*/

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

/* Module declarations from 'renpy.gl.gldraw' */
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw_GLDraw = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct__init = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half = 0;
static PyTypeObject *__pyx_ptype_5renpy_2gl_6gldraw_Environ = 0;
static int __pyx_v_5renpy_2gl_6gldraw_DISSOLVE;
static int __pyx_v_5renpy_2gl_6gldraw_IMAGEDISSOLVE;
static int __pyx_v_5renpy_2gl_6gldraw_PIXELLATE;
static PyObject *__pyx_v_5renpy_2gl_6gldraw_IDENTITY = 0;
#define __Pyx_MODULE_NAME "renpy.gl.gldraw"
int __pyx_module_is_main_renpy__gl__gldraw = 0;

/* Implementation of 'renpy.gl.gldraw' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_sorted;
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw___init__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_allow_fixed); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_2set_mode(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_virtual_size, PyObject *__pyx_v_physical_size, PyObject *__pyx_v_fullscreen); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4deinit(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_6quit(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4init_use_subsystem(PyObject *__pyx_self, PyObject *__pyx_v_module, PyObject *__pyx_v_envvar, PyObject *__pyx_v_envval, PyObject *__pyx_v_req_ext); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8init(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_10should_redraw(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_needs_redraw, PyObject *__pyx_v_first_pass); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12mutated_surface(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_14load_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf, PyObject *__pyx_v_transient); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_16solid_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_h, PyObject *__pyx_v_color); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18clip_mode_screen(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_20clip_mode_rtt(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_22set_clip(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_24draw_screen(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, CYTHON_UNUSED PyObject *__pyx_v_fullscreen_video, PyObject *__pyx_v_flip); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_26draw_render_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, int __pyx_v_non_aligned); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_transformed(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_clip, double __pyx_v_xo, double __pyx_v_yo, double __pyx_v_alpha, double __pyx_v_over, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_30render_to_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self_, PyObject *__pyx_v_what, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_32is_pixel_opaque(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_34get_half(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_36update_mouse(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_38translate_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_40untranslate_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_42mouse_event(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_ev); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_44get_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_46set_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_48draw_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_50screenshot(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, PyObject *__pyx_v_fullscreen_video); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_52free_memory(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_54event_peek_sleep(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_56get_physical_size(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_init(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_2deinit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_4render(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_texture, CYTHON_UNUSED PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_y, CYTHON_UNUSED PyObject *__pyx_v_w, CYTHON_UNUSED PyObject *__pyx_v_h, CYTHON_UNUSED PyObject *__pyx_v_draw_func); /* proto */
static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_6get_size_limit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_dimension); /* proto */
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_GLDraw(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_Environ(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_3[] = "GL Disabled.";
static char __pyx_k_5[] = "";
static char __pyx_k_8[] = "Fullscreen mode.";
static char __pyx_k_11[] = "Windowed mode.";
static char __pyx_k_13[] = "Could not get pygame screen: %r";
static char __pyx_k_14[] = "Screen sizes: virtual=%r physical=%r";
static char __pyx_k_15[] = "Glew init failed: %s";
static char __pyx_k_16[] = "Vendor: %r";
static char __pyx_k_17[] = "Renderer: %r";
static char __pyx_k_18[] = "Version: %r";
static char __pyx_k_19[] = "Display Info: %s";
static char __pyx_k_20[] = "Shaders are blacklisted.";
static char __pyx_k_22[] = "Fixed-function is blacklisted.";
static char __pyx_k_24[] = "GL is totally blacklisted.";
static char __pyx_k_26[] = " ";
static char __pyx_k_28[] = "Extensions:";
static char __pyx_k_30[] = "    %s";
static char __pyx_k_33[] = "/home/tom/ab/renpy/renpy/gl/gldraw.pyx";
static char __pyx_k_34[] = "GLDraw.init.<locals>.use_subsystem";
static char __pyx_k_35[] = "renpy.gl.gldraw";
static char __pyx_k_36[] = "Number of texture units: %d";
static char __pyx_k_37[] = "GL_ARB_vertex_shader";
static char __pyx_k_38[] = "GL_ARB_fragment_shader";
static char __pyx_k_39[] = "Using shader environment.";
static char __pyx_k_41[] = "Initializing shader environment failed:";
static char __pyx_k_43[] = "GL_ARB_texture_env_crossbar";
static char __pyx_k_44[] = "GL_ARB_texture_env_combine";
static char __pyx_k_45[] = "Using fixed-function environment (clause 1).";
static char __pyx_k_47[] = "FixedFunctionEnviron";
static char __pyx_k_48[] = "GL_NV_texture_env_combine4";
static char __pyx_k_49[] = "Using fixed-function environment (clause 2).";
static char __pyx_k_51[] = "RENPY_bogus_extension";
static char __pyx_k_52[] = "Using limited environment.";
static char __pyx_k_54[] = "Can't find a workable environment.";
static char __pyx_k_57[] = "Using copy RTT.";
static char __pyx_k_59[] = "GL_OES_framebuffer_object";
static char __pyx_k_60[] = "GL_ARB_framebuffer_object";
static char __pyx_k_61[] = "Using FBO RTT.";
static char __pyx_k_63[] = "Can't find a workable rtt.";
static char __pyx_k_65[] = "Using {0} renderer.";
static char __pyx_k_67[] = "texture_grid_from_surface";
static char __pyx_k_70[] = "draw_render_textures";
static char __pyx_k_71[] = "Unknown drawing type. ";
static char __pyx_k_74[] = "GLDraw.render_to_texture.<locals>.draw_func";
static char __pyx_k_75[] = "texture_grid_from_drawing";
static char __pyx_k_80[] = "GLDraw.get_half.<locals>.draw_func";
static char __pyx_k_81[] = "Not implemented.";
static char __pyx_k_84[] = "GL error 0x%X at %s";
static char __pyx_k_85[] = "os.path";
static char __pyx_k_86[] = "\n    This is used to report OpenGL errors.\n    ";
static char __pyx_k_89[] = "Rtt.init";
static char __pyx_k_92[] = "Rtt.deinit";
static char __pyx_k_95[] = "Rtt.render";
static char __pyx_k_98[] = "Rtt.get_size_limit";
static char __pyx_k_99[] = "\n    Subclasses of this class handle rendering to a texture.\n    ";
static char __pyx_k__1[] = "1";
static char __pyx_k__h[] = "h";
static char __pyx_k__i[] = "i";
static char __pyx_k__w[] = "w";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__gl[] = "gl";
static char __pyx_k__os[] = "os";
static char __pyx_k__xo[] = "xo";
static char __pyx_k__yo[] = "yo";
static char __pyx_k__Rtt[] = "Rtt";
static char __pyx_k__fbo[] = "fbo";
static char __pyx_k__get[] = "get";
static char __pyx_k__log[] = "log";
static char __pyx_k__pos[] = "pos";
static char __pyx_k__rtt[] = "rtt";
static char __pyx_k__clip[] = "clip";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__fill[] = "fill";
static char __pyx_k__flip[] = "flip";
static char __pyx_k__game[] = "game";
static char __pyx_k__init[] = "init";
static char __pyx_k__kill[] = "kill";
static char __pyx_k__over[] = "over";
static char __pyx_k__quit[] = "quit";
static char __pyx_k__self[] = "self";
static char __pyx_k__surf[] = "surf";
static char __pyx_k__time[] = "time";
static char __pyx_k__what[] = "what";
static char __pyx_k__alpha[] = "alpha";
static char __pyx_k__array[] = "array";
static char __pyx_k__audio[] = "audio";
static char __pyx_k__clear[] = "clear";
static char __pyx_k__color[] = "color";
static char __pyx_k__error[] = "error";
static char __pyx_k__fixed[] = "fixed";
static char __pyx_k__mouse[] = "mouse";
static char __pyx_k__movie[] = "movie";
static char __pyx_k__music[] = "music";
static char __pyx_k__renpy[] = "renpy";
static char __pyx_k__split[] = "split";
static char __pyx_k__value[] = "value";
static char __pyx_k__video[] = "video";
static char __pyx_k__width[] = "width";
static char __pyx_k__write[] = "write";
static char __pyx_k__FboRtt[] = "FboRtt";
static char __pyx_k__OPENGL[] = "OPENGL";
static char __pyx_k__config[] = "config";
static char __pyx_k__deinit[] = "deinit";
static char __pyx_k__envval[] = "envval";
static char __pyx_k__envvar[] = "envvar";
static char __pyx_k__format[] = "format";
static char __pyx_k__height[] = "height";
static char __pyx_k__module[] = "module";
static char __pyx_k__object[] = "object";
static char __pyx_k__pygame[] = "pygame";
static char __pyx_k__render[] = "render";
static char __pyx_k__shader[] = "shader";
static char __pyx_k__sorted[] = "sorted";
static char __pyx_k__use_gl[] = "use_gl";
static char __pyx_k__CopyRtt[] = "CopyRtt";
static char __pyx_k__GLError[] = "GLError";
static char __pyx_k__Surface[] = "Surface";
static char __pyx_k__android[] = "android";
static char __pyx_k__cleanup[] = "cleanup";
static char __pyx_k__display[] = "display";
static char __pyx_k__environ[] = "environ";
static char __pyx_k__get_pos[] = "get_pos";
static char __pyx_k__gl_size[] = "gl_size";
static char __pyx_k__limited[] = "limited";
static char __pyx_k__req_ext[] = "req_ext";
static char __pyx_k__reverse[] = "reverse";
static char __pyx_k__set_pos[] = "set_pos";
static char __pyx_k__surface[] = "surface";
static char __pyx_k__texture[] = "texture";
static char __pyx_k__weakref[] = "weakref";
static char __pyx_k__DISSOLVE[] = "DISSOLVE";
static char __pyx_k__IDENTITY[] = "IDENTITY";
static char __pyx_k__Matrix2D[] = "Matrix2D";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__additive[] = "additive";
static char __pyx_k__get_half[] = "get_half";
static char __pyx_k__get_info[] = "get_info";
static char __pyx_k__get_size[] = "get_size";
static char __pyx_k__pgrender[] = "pgrender";
static char __pyx_k__renderer[] = "renderer";
static char __pyx_k__set_clip[] = "set_clip";
static char __pyx_k__set_mode[] = "set_mode";
static char __pyx_k__surftree[] = "surftree";
static char __pyx_k__use_gles[] = "use_gles";
static char __pyx_k__BLACKLIST[] = "BLACKLIST";
static char __pyx_k__DOUBLEBUF[] = "DOUBLEBUF";
static char __pyx_k__Exception[] = "Exception";
static char __pyx_k__PIXELLATE[] = "PIXELLATE";
static char __pyx_k__RESIZABLE[] = "RESIZABLE";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k__current_h[] = "current_h";
static char __pyx_k__current_w[] = "current_w";
static char __pyx_k__dimension[] = "dimension";
static char __pyx_k__draw_func[] = "draw_func";
static char __pyx_k__exception[] = "exception";
static char __pyx_k__gl_enable[] = "gl_enable";
static char __pyx_k__gl_resize[] = "gl_resize";
static char __pyx_k__glrtt_fbo[] = "glrtt_fbo";
static char __pyx_k__gltexture[] = "gltexture";
static char __pyx_k__interface[] = "interface";
static char __pyx_k__is_opaque[] = "is_opaque";
static char __pyx_k__post_init[] = "post_init";
static char __pyx_k__resizable[] = "resizable";
static char __pyx_k__transient[] = "transient";
static char __pyx_k__FULLSCREEN[] = "FULLSCREEN";
static char __pyx_k____import__[] = "__import__";
static char __pyx_k____module__[] = "__module__";
static char __pyx_k__draw_mouse[] = "draw_mouse";
static char __pyx_k__first_pass[] = "first_pass";
static char __pyx_k__fullscreen[] = "fullscreen";
static char __pyx_k__glrtt_copy[] = "glrtt_copy";
static char __pyx_k__half_cache[] = "half_cache";
static char __pyx_k__subsurface[] = "subsurface";
static char __pyx_k__ImportError[] = "ImportError";
static char __pyx_k__allow_fixed[] = "allow_fixed";
static char __pyx_k__draw_screen[] = "draw_screen";
static char __pyx_k__get_playing[] = "get_playing";
static char __pyx_k__glblacklist[] = "glblacklist";
static char __pyx_k__non_aligned[] = "non_aligned";
static char __pyx_k__set_visible[] = "set_visible";
static char __pyx_k__RENPY_GL_RTT[] = "RENPY_GL_RTT";
static char __pyx_k____qualname__[] = "__qualname__";
static char __pyx_k__load_texture[] = "load_texture";
static char __pyx_k__needs_redraw[] = "needs_redraw";
static char __pyx_k__render_movie[] = "render_movie";
static char __pyx_k__virtual_size[] = "virtual_size";
static char __pyx_k__GL_ALPHA_SIZE[] = "GL_ALPHA_SIZE";
static char __pyx_k__IMAGEDISSOLVE[] = "IMAGEDISSOLVE";
static char __pyx_k__ShaderEnviron[] = "ShaderEnviron";
static char __pyx_k____metaclass__[] = "__metaclass__";
static char __pyx_k__clip_mode_rtt[] = "clip_mode_rtt";
static char __pyx_k__flip_unscaled[] = "flip_unscaled";
static char __pyx_k__kill_textures[] = "kill_textures";
static char __pyx_k__physical_size[] = "physical_size";
static char __pyx_k__use_subsystem[] = "use_subsystem";
static char __pyx_k__LimitedEnviron[] = "LimitedEnviron";
static char __pyx_k__RENPY_GL_VSYNC[] = "RENPY_GL_VSYNC";
static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__";
static char __pyx_k__get_mouse_info[] = "get_mouse_info";
static char __pyx_k__get_size_limit[] = "get_size_limit";
static char __pyx_k__set_rgba_masks[] = "set_rgba_masks";
static char __pyx_k__GL_SWAP_CONTROL[] = "GL_SWAP_CONTROL";
static char __pyx_k__glenviron_fixed[] = "glenviron_fixed";
static char __pyx_k__operation_alpha[] = "operation_alpha";
static char __pyx_k__translate_mouse[] = "translate_mouse";
static char __pyx_k__RENPY_GL_ENVIRON[] = "RENPY_GL_ENVIRON";
static char __pyx_k__clip_mode_screen[] = "clip_mode_screen";
static char __pyx_k__dealloc_textures[] = "dealloc_textures";
static char __pyx_k__draw_transformed[] = "draw_transformed";
static char __pyx_k__fullscreen_video[] = "fullscreen_video";
static char __pyx_k__gl_set_attribute[] = "gl_set_attribute";
static char __pyx_k__glenviron_shader[] = "glenviron_shader";
static char __pyx_k__surface_unscaled[] = "surface_unscaled";
static char __pyx_k__WeakKeyDictionary[] = "WeakKeyDictionary";
static char __pyx_k__glenviron_limited[] = "glenviron_limited";
static char __pyx_k__render_to_texture[] = "render_to_texture";
static char __pyx_k__untranslate_mouse[] = "untranslate_mouse";
static char __pyx_k__operation_complete[] = "operation_complete";
static char __pyx_k__test_texture_sizes[] = "test_texture_sizes";
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_n_s_34;
static PyObject *__pyx_n_s_35;
static PyObject *__pyx_kp_s_36;
static PyObject *__pyx_n_s_37;
static PyObject *__pyx_n_s_38;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_41;
static PyObject *__pyx_n_s_43;
static PyObject *__pyx_n_s_44;
static PyObject *__pyx_kp_s_45;
static PyObject *__pyx_n_s_47;
static PyObject *__pyx_n_s_48;
static PyObject *__pyx_kp_s_49;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_n_s_51;
static PyObject *__pyx_kp_s_52;
static PyObject *__pyx_kp_s_54;
static PyObject *__pyx_kp_s_57;
static PyObject *__pyx_n_s_59;
static PyObject *__pyx_n_s_60;
static PyObject *__pyx_kp_s_61;
static PyObject *__pyx_kp_s_63;
static PyObject *__pyx_kp_s_65;
static PyObject *__pyx_n_s_67;
static PyObject *__pyx_n_s_70;
static PyObject *__pyx_kp_s_71;
static PyObject *__pyx_n_s_74;
static PyObject *__pyx_n_s_75;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_n_s_80;
static PyObject *__pyx_kp_s_81;
static PyObject *__pyx_kp_s_84;
static PyObject *__pyx_n_s_85;
static PyObject *__pyx_kp_s_86;
static PyObject *__pyx_n_s_89;
static PyObject *__pyx_n_s_92;
static PyObject *__pyx_n_s_95;
static PyObject *__pyx_n_s_98;
static PyObject *__pyx_kp_s_99;
static PyObject *__pyx_kp_s__1;
static PyObject *__pyx_n_s__BLACKLIST;
static PyObject *__pyx_n_s__CopyRtt;
static PyObject *__pyx_n_s__DISSOLVE;
static PyObject *__pyx_n_s__DOUBLEBUF;
static PyObject *__pyx_n_s__Exception;
static PyObject *__pyx_n_s__FULLSCREEN;
static PyObject *__pyx_n_s__FboRtt;
static PyObject *__pyx_n_s__GLError;
static PyObject *__pyx_n_s__GL_ALPHA_SIZE;
static PyObject *__pyx_n_s__GL_SWAP_CONTROL;
static PyObject *__pyx_n_s__IDENTITY;
static PyObject *__pyx_n_s__IMAGEDISSOLVE;
static PyObject *__pyx_n_s__ImportError;
static PyObject *__pyx_n_s__LimitedEnviron;
static PyObject *__pyx_n_s__Matrix2D;
static PyObject *__pyx_n_s__OPENGL;
static PyObject *__pyx_n_s__PIXELLATE;
static PyObject *__pyx_n_s__RENPY_GL_ENVIRON;
static PyObject *__pyx_n_s__RENPY_GL_RTT;
static PyObject *__pyx_n_s__RENPY_GL_VSYNC;
static PyObject *__pyx_n_s__RESIZABLE;
static PyObject *__pyx_n_s__Rtt;
static PyObject *__pyx_n_s__ShaderEnviron;
static PyObject *__pyx_n_s__Surface;
static PyObject *__pyx_n_s__WeakKeyDictionary;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____import__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____metaclass__;
static PyObject *__pyx_n_s____module__;
static PyObject *__pyx_n_s____pyx_vtable__;
static PyObject *__pyx_n_s____qualname__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__additive;
static PyObject *__pyx_n_s__allow_fixed;
static PyObject *__pyx_n_s__alpha;
static PyObject *__pyx_n_s__android;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__audio;
static PyObject *__pyx_n_s__cleanup;
static PyObject *__pyx_n_s__clear;
static PyObject *__pyx_n_s__clip;
static PyObject *__pyx_n_s__clip_mode_rtt;
static PyObject *__pyx_n_s__clip_mode_screen;
static PyObject *__pyx_n_s__color;
static PyObject *__pyx_n_s__config;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__current_h;
static PyObject *__pyx_n_s__current_w;
static PyObject *__pyx_n_s__dealloc_textures;
static PyObject *__pyx_n_s__deinit;
static PyObject *__pyx_n_s__dimension;
static PyObject *__pyx_n_s__display;
static PyObject *__pyx_n_s__draw_func;
static PyObject *__pyx_n_s__draw_mouse;
static PyObject *__pyx_n_s__draw_screen;
static PyObject *__pyx_n_s__draw_transformed;
static PyObject *__pyx_n_s__environ;
static PyObject *__pyx_n_s__envval;
static PyObject *__pyx_n_s__envvar;
static PyObject *__pyx_n_s__error;
static PyObject *__pyx_n_s__exception;
static PyObject *__pyx_n_s__fbo;
static PyObject *__pyx_n_s__fill;
static PyObject *__pyx_n_s__first_pass;
static PyObject *__pyx_n_s__fixed;
static PyObject *__pyx_n_s__flip;
static PyObject *__pyx_n_s__flip_unscaled;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_s__fullscreen;
static PyObject *__pyx_n_s__fullscreen_video;
static PyObject *__pyx_n_s__game;
static PyObject *__pyx_n_s__get;
static PyObject *__pyx_n_s__get_half;
static PyObject *__pyx_n_s__get_info;
static PyObject *__pyx_n_s__get_mouse_info;
static PyObject *__pyx_n_s__get_playing;
static PyObject *__pyx_n_s__get_pos;
static PyObject *__pyx_n_s__get_size;
static PyObject *__pyx_n_s__get_size_limit;
static PyObject *__pyx_n_s__gl;
static PyObject *__pyx_n_s__gl_enable;
static PyObject *__pyx_n_s__gl_resize;
static PyObject *__pyx_n_s__gl_set_attribute;
static PyObject *__pyx_n_s__gl_size;
static PyObject *__pyx_n_s__glblacklist;
static PyObject *__pyx_n_s__glenviron_fixed;
static PyObject *__pyx_n_s__glenviron_limited;
static PyObject *__pyx_n_s__glenviron_shader;
static PyObject *__pyx_n_s__glrtt_copy;
static PyObject *__pyx_n_s__glrtt_fbo;
static PyObject *__pyx_n_s__gltexture;
static PyObject *__pyx_n_s__h;
static PyObject *__pyx_n_s__half_cache;
static PyObject *__pyx_n_s__height;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__init;
static PyObject *__pyx_n_s__interface;
static PyObject *__pyx_n_s__is_opaque;
static PyObject *__pyx_n_s__kill;
static PyObject *__pyx_n_s__kill_textures;
static PyObject *__pyx_n_s__limited;
static PyObject *__pyx_n_s__load_texture;
static PyObject *__pyx_n_s__log;
static PyObject *__pyx_n_s__module;
static PyObject *__pyx_n_s__mouse;
static PyObject *__pyx_n_s__movie;
static PyObject *__pyx_n_s__music;
static PyObject *__pyx_n_s__needs_redraw;
static PyObject *__pyx_n_s__non_aligned;
static PyObject *__pyx_n_s__object;
static PyObject *__pyx_n_s__operation_alpha;
static PyObject *__pyx_n_s__operation_complete;
static PyObject *__pyx_n_s__os;
static PyObject *__pyx_n_s__over;
static PyObject *__pyx_n_s__pgrender;
static PyObject *__pyx_n_s__physical_size;
static PyObject *__pyx_n_s__pos;
static PyObject *__pyx_n_s__post_init;
static PyObject *__pyx_n_s__pygame;
static PyObject *__pyx_n_s__quit;
static PyObject *__pyx_n_s__render;
static PyObject *__pyx_n_s__render_movie;
static PyObject *__pyx_n_s__render_to_texture;
static PyObject *__pyx_n_s__renderer;
static PyObject *__pyx_n_s__renpy;
static PyObject *__pyx_n_s__req_ext;
static PyObject *__pyx_n_s__resizable;
static PyObject *__pyx_n_s__reverse;
static PyObject *__pyx_n_s__rtt;
static PyObject *__pyx_n_s__self;
static PyObject *__pyx_n_s__set_clip;
static PyObject *__pyx_n_s__set_mode;
static PyObject *__pyx_n_s__set_pos;
static PyObject *__pyx_n_s__set_rgba_masks;
static PyObject *__pyx_n_s__set_visible;
static PyObject *__pyx_n_s__shader;
static PyObject *__pyx_n_s__sorted;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__subsurface;
static PyObject *__pyx_n_s__surf;
static PyObject *__pyx_n_s__surface;
static PyObject *__pyx_n_s__surface_unscaled;
static PyObject *__pyx_n_s__surftree;
static PyObject *__pyx_n_s__test_texture_sizes;
static PyObject *__pyx_n_s__texture;
static PyObject *__pyx_n_s__time;
static PyObject *__pyx_n_s__transient;
static PyObject *__pyx_n_s__translate_mouse;
static PyObject *__pyx_n_s__untranslate_mouse;
static PyObject *__pyx_n_s__use_gl;
static PyObject *__pyx_n_s__use_gles;
static PyObject *__pyx_n_s__use_subsystem;
static PyObject *__pyx_n_s__value;
static PyObject *__pyx_n_s__video;
static PyObject *__pyx_n_s__virtual_size;
static PyObject *__pyx_n_s__w;
static PyObject *__pyx_n_s__weakref;
static PyObject *__pyx_n_s__what;
static PyObject *__pyx_n_s__width;
static PyObject *__pyx_n_s__write;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xo;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__yo;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_8;
static PyObject *__pyx_int_102;
static PyObject *__pyx_int_255;
static PyObject *__pyx_k_1;
static PyObject *__pyx_k_66;
static PyObject *__pyx_k_68;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_10;
static PyObject *__pyx_k_tuple_12;
static PyObject *__pyx_k_tuple_21;
static PyObject *__pyx_k_tuple_23;
static PyObject *__pyx_k_tuple_25;
static PyObject *__pyx_k_tuple_27;
static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_31;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_42;
static PyObject *__pyx_k_tuple_46;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_53;
static PyObject *__pyx_k_tuple_55;
static PyObject *__pyx_k_tuple_56;
static PyObject *__pyx_k_tuple_58;
static PyObject *__pyx_k_tuple_62;
static PyObject *__pyx_k_tuple_64;
static PyObject *__pyx_k_tuple_69;
static PyObject *__pyx_k_tuple_72;
static PyObject *__pyx_k_tuple_76;
static PyObject *__pyx_k_tuple_77;
static PyObject *__pyx_k_tuple_78;
static PyObject *__pyx_k_tuple_82;
static PyObject *__pyx_k_tuple_83;
static PyObject *__pyx_k_tuple_87;
static PyObject *__pyx_k_tuple_90;
static PyObject *__pyx_k_tuple_93;
static PyObject *__pyx_k_tuple_96;
static PyObject *__pyx_k_codeobj_32;
static PyObject *__pyx_k_codeobj_73;
static PyObject *__pyx_k_codeobj_79;
static PyObject *__pyx_k_codeobj_88;
static PyObject *__pyx_k_codeobj_91;
static PyObject *__pyx_k_codeobj_94;
static PyObject *__pyx_k_codeobj_97;

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_allow_fixed = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__allow_fixed,0};
    PyObject* values[1] = {0};
    values[0] = __pyx_k_1;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  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 (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allow_fixed);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __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_allow_fixed = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw___init__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_allow_fixed);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw___init__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_allow_fixed) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

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

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

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

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

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

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

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

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

  /* "renpy/gl/gldraw.pyx":105
 * 
 *         # This is used to cache the surface->texture operation.
 *         self.texture_cache = weakref.WeakKeyDictionary()             # <<<<<<<<<<<<<<
 * 
 *         # The time of the last redraw.
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__weakref); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__WeakKeyDictionary); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __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 = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->texture_cache);
  __Pyx_DECREF(__pyx_v_self->texture_cache);
  __pyx_v_self->texture_cache = __pyx_t_1;
  __pyx_t_1 = 0;

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

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

  /* "renpy/gl/gldraw.pyx":114
 * 
 *         # Info.
 *         self.info = { "resizable" : True, "additive" : True }             # <<<<<<<<<<<<<<
 * 
 *         if not ANGLE:
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__resizable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__additive), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->info);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->info));
  __pyx_v_self->info = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":117
 * 
 *         if not ANGLE:
 *             self.info["renderer"] = "gl"             # <<<<<<<<<<<<<<
 *         else:
 *             self.info["renderer"] = "angle"
 */
  if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  if (PyDict_SetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__renderer), ((PyObject *)__pyx_n_s__gl)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

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

  /* "renpy/gl/gldraw.pyx":129
 * 
 *         # The display info, from pygame.
 *         self.display_info = None             # <<<<<<<<<<<<<<
 * 
 *         # The amount we're upscaling by.
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->display_info);
  __Pyx_DECREF(__pyx_v_self->display_info);
  __pyx_v_self->display_info = Py_None;

  /* "renpy/gl/gldraw.pyx":132
 * 
 *         # The amount we're upscaling by.
 *         self.upscale_factor = 1.0             # <<<<<<<<<<<<<<
 * 
 *         # Should we use the fast (but incorrect) dissolve mode?
 */
  __pyx_v_self->upscale_factor = 1.0;

  /* "renpy/gl/gldraw.pyx":135
 * 
 *         # Should we use the fast (but incorrect) dissolve mode?
 *         self.fast_dissolve = False # renpy.android             # <<<<<<<<<<<<<<
 * 
 *         # Should we always report pixels as being always opaque?
 */
  __pyx_v_self->fast_dissolve = 0;

  /* "renpy/gl/gldraw.pyx":138
 * 
 *         # Should we always report pixels as being always opaque?
 *         self.always_opaque = renpy.android             # <<<<<<<<<<<<<<
 * 
 *         # Should we allow the fixed-function environment?
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__android); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __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_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_self->always_opaque = __pyx_t_3;

  /* "renpy/gl/gldraw.pyx":141
 * 
 *         # Should we allow the fixed-function environment?
 *         self.allow_fixed = allow_fixed             # <<<<<<<<<<<<<<
 * 
 *     def set_mode(self, virtual_size, physical_size, fullscreen):
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->allow_fixed = __pyx_t_3;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3set_mode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_2set_mode[] = "\n        This changes the video mode. It also initializes OpenGL, if it\n        can. It returns True if it was succesful, or False if OpenGL isn't\n        working for some reason.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3set_mode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_virtual_size = 0;
  PyObject *__pyx_v_physical_size = 0;
  PyObject *__pyx_v_fullscreen = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_mode (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__virtual_size,&__pyx_n_s__physical_size,&__pyx_n_s__fullscreen,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__virtual_size)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__physical_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fullscreen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __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_virtual_size = values[0];
    __pyx_v_physical_size = values[1];
    __pyx_v_fullscreen = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_2set_mode(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_virtual_size, __pyx_v_physical_size, __pyx_v_fullscreen);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_2set_mode(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_virtual_size, PyObject *__pyx_v_physical_size, PyObject *__pyx_v_fullscreen) {
  PyObject *__pyx_v_vwidth = NULL;
  PyObject *__pyx_v_vheight = NULL;
  PyObject *__pyx_v_pwidth = NULL;
  PyObject *__pyx_v_pheight = NULL;
  PyObject *__pyx_v_virtual_ar = NULL;
  PyObject *__pyx_v_vsync = NULL;
  PyObject *__pyx_v_opengl = NULL;
  PyObject *__pyx_v_resizable = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_physical_ar = NULL;
  PyObject *__pyx_v_x_padding = NULL;
  PyObject *__pyx_v_y_padding = NULL;
  PyObject *__pyx_v_px_padding = NULL;
  PyObject *__pyx_v_py_padding = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_mode", 0);
  __Pyx_INCREF(__pyx_v_fullscreen);

  /* "renpy/gl/gldraw.pyx":152
 *         cdef char *egl_error
 * 
 *         if not renpy.config.gl_enable:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("GL Disabled.")
 *             return False
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__config); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__gl_enable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __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 = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = ((!__pyx_t_3) != 0);
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":153
 * 
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __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_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __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/gl/gldraw.pyx":154
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self.did_init:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __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_L3;
  }
  __pyx_L3:;

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

    /* "renpy/gl/gldraw.pyx":157
 * 
 *         if self.did_init:
 *             self.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if renpy.android:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__deinit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __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 = 157; __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;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "renpy/gl/gldraw.pyx":159
 *             self.deinit()
 * 
 *         if renpy.android:             # <<<<<<<<<<<<<<
 *             fullscreen = False
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__android); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":160
 * 
 *         if renpy.android:
 *             fullscreen = False             # <<<<<<<<<<<<<<
 * 
 *         if fullscreen != self.old_fullscreen:
 */
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_fullscreen, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "renpy/gl/gldraw.pyx":162
 *             fullscreen = False
 * 
 *         if fullscreen != self.old_fullscreen:             # <<<<<<<<<<<<<<
 * 
 *             self.did_init = False
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_fullscreen, __pyx_v_self->old_fullscreen, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

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

    /* "renpy/gl/gldraw.pyx":166
 *             self.did_init = False
 * 
 *             if self.old_fullscreen is not None:             # <<<<<<<<<<<<<<
 *                 pygame.display.quit()
 * 
 */
    __pyx_t_4 = (__pyx_v_self->old_fullscreen != Py_None);
    __pyx_t_3 = (__pyx_t_4 != 0);
    if (__pyx_t_3) {

      /* "renpy/gl/gldraw.pyx":167
 * 
 *             if self.old_fullscreen is not None:
 *                 pygame.display.quit()             # <<<<<<<<<<<<<<
 * 
 *             pygame.display.init()
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__quit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __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 = 167; __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;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "renpy/gl/gldraw.pyx":169
 *                 pygame.display.quit()
 * 
 *             pygame.display.init()             # <<<<<<<<<<<<<<
 * 
 *             if self.display_info is None:
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __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 = 169; __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/gl/gldraw.pyx":171
 *             pygame.display.init()
 * 
 *             if self.display_info is None:             # <<<<<<<<<<<<<<
 *                 self.display_info = renpy.display.get_info()
 * 
 */
    __pyx_t_3 = (__pyx_v_self->display_info == Py_None);
    __pyx_t_4 = (__pyx_t_3 != 0);
    if (__pyx_t_4) {

      /* "renpy/gl/gldraw.pyx":172
 * 
 *             if self.display_info is None:
 *                 self.display_info = renpy.display.get_info()             # <<<<<<<<<<<<<<
 * 
 *             self.old_fullscreen = fullscreen
 */
      __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__get_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->display_info);
      __Pyx_DECREF(__pyx_v_self->display_info);
      __pyx_v_self->display_info = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;

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

    /* "renpy/gl/gldraw.pyx":176
 *             self.old_fullscreen = fullscreen
 * 
 *             renpy.display.interface.post_init()             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__interface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__post_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __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 = 176; __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;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/gl/gldraw.pyx":178
 *             renpy.display.interface.post_init()
 * 
 *         renpy.display.log.write("")             # <<<<<<<<<<<<<<
 * 
 *         self.virtual_size = virtual_size
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __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_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __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/gl/gldraw.pyx":180
 *         renpy.display.log.write("")
 * 
 *         self.virtual_size = virtual_size             # <<<<<<<<<<<<<<
 * 
 *         vwidth, vheight = virtual_size
 */
  if (!(likely(PyTuple_CheckExact(__pyx_v_virtual_size))||((__pyx_v_virtual_size) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_virtual_size)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_virtual_size);
  __Pyx_GIVEREF(__pyx_v_virtual_size);
  __Pyx_GOTREF(__pyx_v_self->virtual_size);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->virtual_size));
  __pyx_v_self->virtual_size = ((PyObject*)__pyx_v_virtual_size);

  /* "renpy/gl/gldraw.pyx":182
 *         self.virtual_size = virtual_size
 * 
 *         vwidth, vheight = virtual_size             # <<<<<<<<<<<<<<
 *         pwidth, pheight = physical_size
 *         virtual_ar = 1.0 * vwidth / vheight
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_virtual_size))) || (PyList_CheckExact(__pyx_v_virtual_size))) {
    PyObject* sequence = __pyx_v_virtual_size;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    #endif
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_v_virtual_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __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_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L10_unpacking_done:;
  }
  __pyx_v_vwidth = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vheight = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":183
 * 
 *         vwidth, vheight = virtual_size
 *         pwidth, pheight = physical_size             # <<<<<<<<<<<<<<
 *         virtual_ar = 1.0 * vwidth / vheight
 * 
 */
  if ((likely(PyTuple_CheckExact(__pyx_v_physical_size))) || (PyList_CheckExact(__pyx_v_physical_size))) {
    PyObject* sequence = __pyx_v_physical_size;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    #endif
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_5 = PyObject_GetIter(__pyx_v_physical_size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __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_L11_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_L11_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L12_unpacking_done:;
  }
  __pyx_v_pwidth = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_pheight = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":184
 *         vwidth, vheight = virtual_size
 *         pwidth, pheight = physical_size
 *         virtual_ar = 1.0 * vwidth / vheight             # <<<<<<<<<<<<<<
 * 
 *         pwidth = max(vwidth / 2, pwidth)
 */
  __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_vwidth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_vheight); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_virtual_ar = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":186
 *         virtual_ar = 1.0 * vwidth / vheight
 * 
 *         pwidth = max(vwidth / 2, pwidth)             # <<<<<<<<<<<<<<
 *         pheight = max(vheight / 2, pheight)
 * 
 */
  __Pyx_INCREF(__pyx_v_pwidth);
  __pyx_t_2 = __pyx_v_pwidth;
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_vwidth, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_5 = __pyx_t_2;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_5;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":187
 * 
 *         pwidth = max(vwidth / 2, pwidth)
 *         pheight = max(vheight / 2, pheight)             # <<<<<<<<<<<<<<
 * 
 *         if renpy.android:
 */
  __Pyx_INCREF(__pyx_v_pheight);
  __pyx_t_2 = __pyx_v_pheight;
  __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_vheight, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":189
 *         pheight = max(vheight / 2, pheight)
 * 
 *         if renpy.android:             # <<<<<<<<<<<<<<
 *             pheight = self.display_info.current_h
 *             pwidth = self.display_info.current_w
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__android); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":190
 * 
 *         if renpy.android:
 *             pheight = self.display_info.current_h             # <<<<<<<<<<<<<<
 *             pwidth = self.display_info.current_w
 *         else:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->display_info, __pyx_n_s__current_h); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":191
 *         if renpy.android:
 *             pheight = self.display_info.current_h
 *             pwidth = self.display_info.current_w             # <<<<<<<<<<<<<<
 *         else:
 *             pheight = min(self.display_info.current_h - 102, pheight)
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->display_info, __pyx_n_s__current_w); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L13;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":193
 *             pwidth = self.display_info.current_w
 *         else:
 *             pheight = min(self.display_info.current_h - 102, pheight)             # <<<<<<<<<<<<<<
 *             pwidth = min(self.display_info.current_w - 102, pwidth)
 * 
 */
    __Pyx_INCREF(__pyx_v_pheight);
    __pyx_t_1 = __pyx_v_pheight;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->display_info, __pyx_n_s__current_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_int_102); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_4) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":194
 *         else:
 *             pheight = min(self.display_info.current_h - 102, pheight)
 *             pwidth = min(self.display_info.current_w - 102, pwidth)             # <<<<<<<<<<<<<<
 * 
 *             # The first time through.
 */
    __Pyx_INCREF(__pyx_v_pwidth);
    __pyx_t_1 = __pyx_v_pwidth;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->display_info, __pyx_n_s__current_w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_int_102); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_4) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_2;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_1);
    __pyx_t_1 = 0;

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

      /* "renpy/gl/gldraw.pyx":198
 *             # The first time through.
 *             if not self.did_init:
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)             # <<<<<<<<<<<<<<
 * 
 *         pwidth = int(pwidth)
 */
      __Pyx_INCREF(__pyx_v_pwidth);
      __pyx_t_1 = __pyx_v_pwidth;
      __pyx_t_2 = PyNumber_Multiply(__pyx_v_pheight, __pyx_v_virtual_ar); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_4) {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1;
      } else {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = __pyx_t_2;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_v_pheight);
      __pyx_t_5 = __pyx_v_pheight;
      __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_pwidth, __pyx_v_virtual_ar); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_4) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_7 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_7 = __pyx_t_2;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_1);
      __pyx_t_1 = 0;
      __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_5);
      __pyx_t_5 = 0;
      goto __pyx_L14;
    }
    __pyx_L14:;
  }
  __pyx_L13:;

  /* "renpy/gl/gldraw.pyx":200
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)
 * 
 *         pwidth = int(pwidth)             # <<<<<<<<<<<<<<
 *         pheight = int(pheight)
 * 
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_pwidth);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pwidth);
  __Pyx_GIVEREF(__pyx_v_pwidth);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":201
 * 
 *         pwidth = int(pwidth)
 *         pheight = int(pheight)             # <<<<<<<<<<<<<<
 * 
 *         pwidth = max(pwidth, 256)
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_pheight);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pheight);
  __Pyx_GIVEREF(__pyx_v_pheight);
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":203
 *         pheight = int(pheight)
 * 
 *         pwidth = max(pwidth, 256)             # <<<<<<<<<<<<<<
 *         pheight = max(pheight, 256)
 * 
 */
  __pyx_t_9 = 256;
  __Pyx_INCREF(__pyx_v_pwidth);
  __pyx_t_5 = __pyx_v_pwidth;
  __pyx_t_7 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_4) {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":204
 * 
 *         pwidth = max(pwidth, 256)
 *         pheight = max(pheight, 256)             # <<<<<<<<<<<<<<
 * 
 *         # Handle swap control.
 */
  __pyx_t_9 = 256;
  __Pyx_INCREF(__pyx_v_pheight);
  __pyx_t_5 = __pyx_v_pheight;
  __pyx_t_2 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {
    __pyx_t_7 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":207
 * 
 *         # Handle swap control.
 *         vsync = int(os.environ.get("RENPY_GL_VSYNC", "1"))             # <<<<<<<<<<<<<<
 * 
 *         if ANGLE:
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__environ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __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_k_tuple_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_v_vsync = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":212
 *             opengl = 0
 *             resizable = 0
 *         elif renpy.android:             # <<<<<<<<<<<<<<
 *             opengl = pygame.OPENGL
 *             resizable = 0
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__android); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":213
 *             resizable = 0
 *         elif renpy.android:
 *             opengl = pygame.OPENGL             # <<<<<<<<<<<<<<
 *             resizable = 0
 *         else:
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__OPENGL); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_opengl = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":214
 *         elif renpy.android:
 *             opengl = pygame.OPENGL
 *             resizable = 0             # <<<<<<<<<<<<<<
 *         else:
 *             opengl = pygame.OPENGL
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_resizable = __pyx_int_0;
    goto __pyx_L15;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":216
 *             resizable = 0
 *         else:
 *             opengl = pygame.OPENGL             # <<<<<<<<<<<<<<
 *             pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, vsync)
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__OPENGL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_opengl = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":217
 *         else:
 *             opengl = pygame.OPENGL
 *             pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, vsync)             # <<<<<<<<<<<<<<
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 * 
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__gl_set_attribute); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__GL_SWAP_CONTROL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __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 = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_v_vsync);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_vsync);
    __Pyx_GIVEREF(__pyx_v_vsync);
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":218
 *             opengl = pygame.OPENGL
 *             pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, vsync)
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)             # <<<<<<<<<<<<<<
 * 
 *             if renpy.config.gl_resize:
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__gl_set_attribute); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__GL_ALPHA_SIZE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __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 = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_int_8);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_8);
    __Pyx_GIVEREF(__pyx_int_8);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":220
 *             pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 * 
 *             if renpy.config.gl_resize:             # <<<<<<<<<<<<<<
 *                 resizable = pygame.RESIZABLE
 *             else:
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__config); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__gl_resize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_4) {

      /* "renpy/gl/gldraw.pyx":221
 * 
 *             if renpy.config.gl_resize:
 *                 resizable = pygame.RESIZABLE             # <<<<<<<<<<<<<<
 *             else:
 *                 resizable = 0
 */
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__RESIZABLE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_v_resizable = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L16;
    }
    /*else*/ {

      /* "renpy/gl/gldraw.pyx":223
 *                 resizable = pygame.RESIZABLE
 *             else:
 *                 resizable = 0             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
      __Pyx_INCREF(__pyx_int_0);
      __pyx_v_resizable = __pyx_int_0;
    }
    __pyx_L16:;
  }
  __pyx_L15:;

  /* "renpy/gl/gldraw.pyx":225
 *                 resizable = 0
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if fullscreen:
 *                 renpy.display.log.write("Fullscreen mode.")
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_12);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":226
 * 
 *         try:
 *             if fullscreen:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | opengl | pygame.DOUBLEBUF)
 */
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_fullscreen); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
      if (__pyx_t_4) {

        /* "renpy/gl/gldraw.pyx":227
 *         try:
 *             if fullscreen:
 *                 renpy.display.log.write("Fullscreen mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | opengl | pygame.DOUBLEBUF)
 *             else:
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L17_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_k_tuple_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "renpy/gl/gldraw.pyx":228
 *             if fullscreen:
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | opengl | pygame.DOUBLEBUF)             # <<<<<<<<<<<<<<
 *             else:
 *                 renpy.display.log.write("Windowed mode.")
 */
        __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__set_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__FULLSCREEN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Or(__pyx_t_7, __pyx_v_opengl); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__DOUBLEBUF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Or(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __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 = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(((PyObject *)__pyx_k_tuple_10));
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_k_tuple_10));
        __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_v_self->window);
        __Pyx_DECREF(__pyx_v_self->window);
        __pyx_v_self->window = __pyx_t_7;
        __pyx_t_7 = 0;
        goto __pyx_L25;
      }
      /*else*/ {

        /* "renpy/gl/gldraw.pyx":230
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | opengl | pygame.DOUBLEBUF)
 *             else:
 *                 renpy.display.log.write("Windowed mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF)
 * 
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "renpy/gl/gldraw.pyx":231
 *             else:
 *                 renpy.display.log.write("Windowed mode.")
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF)             # <<<<<<<<<<<<<<
 * 
 *         except pygame.error, e:
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__set_mode); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_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 = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_pwidth);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pwidth);
        __Pyx_GIVEREF(__pyx_v_pwidth);
        __Pyx_INCREF(__pyx_v_pheight);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pheight);
        __Pyx_GIVEREF(__pyx_v_pheight);
        __pyx_t_1 = PyNumber_Or(__pyx_v_resizable, __pyx_v_opengl); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__DOUBLEBUF); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyNumber_Or(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_2));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        __pyx_t_2 = 0;
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GOTREF(__pyx_v_self->window);
        __Pyx_DECREF(__pyx_v_self->window);
        __pyx_v_self->window = __pyx_t_5;
        __pyx_t_5 = 0;
      }
      __pyx_L25:;
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L24_try_end;
    __pyx_L17_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":233
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF)
 * 
 *         except pygame.error, e:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Could not get pygame screen: %r", e)
 *             return False
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_13 = PyErr_ExceptionMatches(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_13) {
      __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_5, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_e = __pyx_t_5;

      /* "renpy/gl/gldraw.pyx":234
 * 
 *         except pygame.error, e:
 *             renpy.display.log.write("Could not get pygame screen: %r", e)             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __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 = 234; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
      __Pyx_INCREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      __pyx_t_14 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "renpy/gl/gldraw.pyx":235
 *         except pygame.error, e:
 *             renpy.display.log.write("Could not get pygame screen: %r", e)
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # In ANGLE mode, we have to use EGL to get the OpenGL ES 2 context.
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_14 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_r = __pyx_t_14;
      __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L20_except_return;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L18_exception_handled;
    }
    __pyx_L19_except_error:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L1_error;
    __pyx_L20_except_return:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    goto __pyx_L0;
    __pyx_L18_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_XGIVEREF(__pyx_t_12);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
    __pyx_L24_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":250
 * 
 *         # Get the size of the created screen.
 *         pwidth, pheight = self.window.get_size()             # <<<<<<<<<<<<<<
 *         self.physical_size = (pwidth, pheight)
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->window, __pyx_n_s__get_size); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_7 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_7);
    __Pyx_INCREF(__pyx_t_8);
    #else
    __pyx_t_7 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_14 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_14)->tp_iternext;
    index = 0; __pyx_t_7 = __pyx_t_6(__pyx_t_14); if (unlikely(!__pyx_t_7)) goto __pyx_L28_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_7);
    index = 1; __pyx_t_8 = __pyx_t_6(__pyx_t_14); if (unlikely(!__pyx_t_8)) goto __pyx_L28_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = NULL;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    goto __pyx_L29_unpacking_done;
    __pyx_L28_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_6 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L29_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_pwidth, __pyx_t_7);
  __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_pheight, __pyx_t_8);
  __pyx_t_8 = 0;

  /* "renpy/gl/gldraw.pyx":251
 *         # Get the size of the created screen.
 *         pwidth, pheight = self.window.get_size()
 *         self.physical_size = (pwidth, pheight)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Screen sizes: virtual=%r physical=%r" % (self.virtual_size, self.physical_size))
 */
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_pwidth);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pwidth);
  __Pyx_GIVEREF(__pyx_v_pwidth);
  __Pyx_INCREF(__pyx_v_pheight);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_pheight);
  __Pyx_GIVEREF(__pyx_v_pheight);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
  __Pyx_GOTREF(__pyx_v_self->physical_size);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->physical_size));
  __pyx_v_self->physical_size = ((PyObject*)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":253
 *         self.physical_size = (pwidth, pheight)
 * 
 *         renpy.display.log.write("Screen sizes: virtual=%r physical=%r" % (self.virtual_size, self.physical_size))             # <<<<<<<<<<<<<<
 * 
 *         # Figure out the virtual box, which includes padding around
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __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 = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->virtual_size));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_self->virtual_size));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->virtual_size));
  __Pyx_INCREF(((PyObject *)__pyx_v_self->physical_size));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_self->physical_size));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->physical_size));
  __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":257
 *         # Figure out the virtual box, which includes padding around
 *         # the borders.
 *         physical_ar = 1.0 * pwidth / pheight             # <<<<<<<<<<<<<<
 * 
 *         if physical_ar >= virtual_ar:
 */
  __pyx_t_7 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_7, __pyx_v_pwidth); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_pheight); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_physical_ar = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":259
 *         physical_ar = 1.0 * pwidth / pheight
 * 
 *         if physical_ar >= virtual_ar:             # <<<<<<<<<<<<<<
 *             x_padding = physical_ar * vheight - vwidth
 *             y_padding = 0
 */
  __pyx_t_7 = PyObject_RichCompare(__pyx_v_physical_ar, __pyx_v_virtual_ar, Py_GE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":260
 * 
 *         if physical_ar >= virtual_ar:
 *             x_padding = physical_ar * vheight - vwidth             # <<<<<<<<<<<<<<
 *             y_padding = 0
 *             px_padding = x_padding * pheight / vheight
 */
    __pyx_t_7 = PyNumber_Multiply(__pyx_v_physical_ar, __pyx_v_vheight); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_7, __pyx_v_vwidth); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_x_padding = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":261
 *         if physical_ar >= virtual_ar:
 *             x_padding = physical_ar * vheight - vwidth
 *             y_padding = 0             # <<<<<<<<<<<<<<
 *             px_padding = x_padding * pheight / vheight
 *             py_padding = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_y_padding = __pyx_int_0;

    /* "renpy/gl/gldraw.pyx":262
 *             x_padding = physical_ar * vheight - vwidth
 *             y_padding = 0
 *             px_padding = x_padding * pheight / vheight             # <<<<<<<<<<<<<<
 *             py_padding = 0
 *         else:
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_x_padding, __pyx_v_pheight); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_vheight); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_px_padding = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "renpy/gl/gldraw.pyx":263
 *             y_padding = 0
 *             px_padding = x_padding * pheight / vheight
 *             py_padding = 0             # <<<<<<<<<<<<<<
 *         else:
 *             x_padding = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_py_padding = __pyx_int_0;
    goto __pyx_L30;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":265
 *             py_padding = 0
 *         else:
 *             x_padding = 0             # <<<<<<<<<<<<<<
 *             y_padding = ( 1.0 / physical_ar ) * vwidth - vheight
 *             px_padding = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_x_padding = __pyx_int_0;

    /* "renpy/gl/gldraw.pyx":266
 *         else:
 *             x_padding = 0
 *             y_padding = ( 1.0 / physical_ar ) * vwidth - vheight             # <<<<<<<<<<<<<<
 *             px_padding = 0
 *             py_padding = y_padding * pwidth / vwidth
 */
    __pyx_t_7 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_v_physical_ar); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyNumber_Multiply(__pyx_t_5, __pyx_v_vwidth); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_7, __pyx_v_vheight); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_y_padding = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":267
 *             x_padding = 0
 *             y_padding = ( 1.0 / physical_ar ) * vwidth - vheight
 *             px_padding = 0             # <<<<<<<<<<<<<<
 *             py_padding = y_padding * pwidth / vwidth
 * 
 */
    __Pyx_INCREF(__pyx_int_0);
    __pyx_v_px_padding = __pyx_int_0;

    /* "renpy/gl/gldraw.pyx":268
 *             y_padding = ( 1.0 / physical_ar ) * vwidth - vheight
 *             px_padding = 0
 *             py_padding = y_padding * pwidth / vwidth             # <<<<<<<<<<<<<<
 * 
 *         # The position of the physical screen, in virtual pixels
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_y_padding, __pyx_v_pwidth); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_vwidth); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_py_padding = __pyx_t_7;
    __pyx_t_7 = 0;
  }
  __pyx_L30:;

  /* "renpy/gl/gldraw.pyx":275
 *         # screen.
 *         self.virtual_box = (
 *             -x_padding / 2.0,             # <<<<<<<<<<<<<<
 *             -y_padding / 2.0,
 *              vwidth + x_padding,
 */
  __pyx_t_7 = PyNumber_Negative(__pyx_v_x_padding); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __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_5); __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":276
 *         self.virtual_box = (
 *             -x_padding / 2.0,
 *             -y_padding / 2.0,             # <<<<<<<<<<<<<<
 *              vwidth + x_padding,
 *              vheight + y_padding)
 */
  __pyx_t_5 = PyNumber_Negative(__pyx_v_y_padding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_14 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":277
 *             -x_padding / 2.0,
 *             -y_padding / 2.0,
 *              vwidth + x_padding,             # <<<<<<<<<<<<<<
 *              vheight + y_padding)
 * 
 */
  __pyx_t_7 = PyNumber_Add(__pyx_v_vwidth, __pyx_v_x_padding); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "renpy/gl/gldraw.pyx":278
 *             -y_padding / 2.0,
 *              vwidth + x_padding,
 *              vheight + y_padding)             # <<<<<<<<<<<<<<
 * 
 *         # The location of the virtual screen on the physical screen, in
 */
  __pyx_t_5 = PyNumber_Add(__pyx_v_vheight, __pyx_v_y_padding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_8 = 0;
  __pyx_t_14 = 0;
  __pyx_t_7 = 0;
  __pyx_t_5 = 0;

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

  /* "renpy/gl/gldraw.pyx":284
 *         # enough for screenshots.)
 *         self.physical_box = (
 *             int(px_padding / 2),             # <<<<<<<<<<<<<<
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),
 */
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_px_padding, __pyx_int_2); 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);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_5), NULL); 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);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":285
 *         self.physical_box = (
 *             int(px_padding / 2),
 *             int(py_padding / 2),             # <<<<<<<<<<<<<<
 *             pwidth - int(px_padding),
 *             pheight - int(py_padding),
 */
  __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_v_py_padding, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;

  /* "renpy/gl/gldraw.pyx":286
 *             int(px_padding / 2),
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),             # <<<<<<<<<<<<<<
 *             pheight - int(py_padding),
 *             )
 */
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_px_padding);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_px_padding);
  __Pyx_GIVEREF(__pyx_v_px_padding);
  __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_7 = PyNumber_Subtract(__pyx_v_pwidth, __pyx_t_14); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "renpy/gl/gldraw.pyx":287
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),
 *             pheight - int(py_padding),             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  __pyx_t_14 = PyTuple_New(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_INCREF(__pyx_v_py_padding);
  PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_v_py_padding);
  __Pyx_GIVEREF(__pyx_v_py_padding);
  __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
  __pyx_t_14 = PyNumber_Subtract(__pyx_v_pheight, __pyx_t_8); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_7 = 0;
  __pyx_t_14 = 0;

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

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

    /* "renpy/gl/gldraw.pyx":291
 * 
 *         if not self.did_init:
 *             if not self.init():             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__init); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_14 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __pyx_t_3 = ((!__pyx_t_4) != 0);
    if (__pyx_t_3) {

      /* "renpy/gl/gldraw.pyx":292
 *         if not self.did_init:
 *             if not self.init():
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         self.did_init = True
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_14 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_r = __pyx_t_14;
      __pyx_t_14 = 0;
      goto __pyx_L0;
      goto __pyx_L32;
    }
    __pyx_L32:;
    goto __pyx_L31;
  }
  __pyx_L31:;

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

  /* "renpy/gl/gldraw.pyx":297
 * 
 *         # Set some default settings.
 *         glEnable(GL_BLEND)             # <<<<<<<<<<<<<<
 *         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
 * 
 */
  glEnable(GL_BLEND);

  /* "renpy/gl/gldraw.pyx":298
 *         # Set some default settings.
 *         glEnable(GL_BLEND)
 *         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)             # <<<<<<<<<<<<<<
 * 
 *         # Prepare a mouse display.
 */
  glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

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

  /* "renpy/gl/gldraw.pyx":303
 *         self.mouse_old_visible = None
 * 
 *         self.environ.init()             # <<<<<<<<<<<<<<
 *         self.rtt.init()
 * 
 */
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s__init); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_t_8 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "renpy/gl/gldraw.pyx":304
 * 
 *         self.environ.init()
 *         self.rtt.init()             # <<<<<<<<<<<<<<
 * 
 *         gl_check("set_mode")
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s__init); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_14 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "renpy/gl/gldraw.pyx":306
 *         self.rtt.init()
 * 
 *         gl_check("set_mode")             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
  __pyx_t_14 = __pyx_f_5renpy_2gl_2gl_gl_check(((PyObject *)__pyx_n_s__set_mode)); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "renpy/gl/gldraw.pyx":308
 *         gl_check("set_mode")
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def deinit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_14 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __pyx_r = __pyx_t_14;
  __pyx_t_14 = 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_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_vwidth);
  __Pyx_XDECREF(__pyx_v_vheight);
  __Pyx_XDECREF(__pyx_v_pwidth);
  __Pyx_XDECREF(__pyx_v_pheight);
  __Pyx_XDECREF(__pyx_v_virtual_ar);
  __Pyx_XDECREF(__pyx_v_vsync);
  __Pyx_XDECREF(__pyx_v_opengl);
  __Pyx_XDECREF(__pyx_v_resizable);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_physical_ar);
  __Pyx_XDECREF(__pyx_v_x_padding);
  __Pyx_XDECREF(__pyx_v_y_padding);
  __Pyx_XDECREF(__pyx_v_px_padding);
  __Pyx_XDECREF(__pyx_v_py_padding);
  __Pyx_XDECREF(__pyx_v_fullscreen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_5deinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_4deinit[] = "\n        De-initializes the system in preparation for a restart, or\n        quit. Flushes out all the textures while it's at it.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_5deinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deinit (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4deinit(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":310
 *         return True
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         """
 *         De-initializes the system in preparation for a restart, or
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4deinit(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("deinit", 0);

  /* "renpy/gl/gldraw.pyx":316
 *         """
 * 
 *         renpy.display.interface.kill_textures()             # <<<<<<<<<<<<<<
 * 
 *         self.texture_cache.clear()
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__interface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__kill_textures); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __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 = 316; __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/gl/gldraw.pyx":318
 *         renpy.display.interface.kill_textures()
 * 
 *         self.texture_cache.clear()             # <<<<<<<<<<<<<<
 * 
 *         gltexture.dealloc_textures()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->texture_cache, __pyx_n_s__clear); 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_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":320
 *         self.texture_cache.clear()
 * 
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 * 
 *         if self.rtt:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__dealloc_textures); 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_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 = 320; __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/gl/gldraw.pyx":322
 *         gltexture.dealloc_textures()
 * 
 *         if self.rtt:             # <<<<<<<<<<<<<<
 *             self.rtt.deinit()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_self->rtt); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":323
 * 
 *         if self.rtt:
 *             self.rtt.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if self.environ:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s__deinit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __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 = 323; __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;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":325
 *             self.rtt.deinit()
 * 
 *         if self.environ:             # <<<<<<<<<<<<<<
 *             self.environ.deinit()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->environ)); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":326
 * 
 *         if self.environ:
 *             self.environ.deinit()             # <<<<<<<<<<<<<<
 * 
 *     def quit(self):
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s__deinit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __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 = 326; __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;
    goto __pyx_L4;
  }
  __pyx_L4:;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_7quit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_7quit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("quit (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_6quit(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":328
 *             self.environ.deinit()
 * 
 *     def quit(self):             # <<<<<<<<<<<<<<
 * 
 *         if not self.old_fullscreen:
 */

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

  /* "renpy/gl/gldraw.pyx":330
 *     def quit(self):
 * 
 *         if not self.old_fullscreen:             # <<<<<<<<<<<<<<
 *             renpy.display.gl_size = self.physical_size
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->old_fullscreen); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":331
 * 
 *         if not self.old_fullscreen:
 *             renpy.display.gl_size = self.physical_size             # <<<<<<<<<<<<<<
 * 
 *         gltexture.dealloc_textures()
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->physical_size);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_t_5, __pyx_n_s__gl_size, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":333
 *             renpy.display.gl_size = self.physical_size
 * 
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 * 
 *         self.old_fullscreen = None
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__dealloc_textures); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

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

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.quit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

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

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

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

    /* "renpy/gl/gldraw.pyx":410
 * 
 *             if module is None:
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             value = os.environ.get(envvar, "")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":412
 *                 return False
 * 
 *             value = os.environ.get(envvar, "")             # <<<<<<<<<<<<<<
 *             if value:
 *                 if value == envval:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); 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);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__environ); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__get); 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);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_envvar);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_envvar);
  __Pyx_GIVEREF(__pyx_v_envvar);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_kp_s_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
  __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 = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_v_value = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":413
 * 
 *             value = os.environ.get(envvar, "")
 *             if value:             # <<<<<<<<<<<<<<
 *                 if value == envval:
 *                     return True
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":414
 *             value = os.environ.get(envvar, "")
 *             if value:
 *                 if value == envval:             # <<<<<<<<<<<<<<
 *                     return True
 *                 else:
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_value, __pyx_v_envval, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_2) {

      /* "renpy/gl/gldraw.pyx":415
 *             if value:
 *                 if value == envval:
 *                     return True             # <<<<<<<<<<<<<<
 *                 else:
 *                     return False
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "renpy/gl/gldraw.pyx":417
 *                     return True
 *                 else:
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *             for i in req_ext:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L0;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "renpy/gl/gldraw.pyx":419
 *                     return False
 * 
 *             for i in req_ext:             # <<<<<<<<<<<<<<
 *                 if i not in extensions:
 *                     return False
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_req_ext); __Pyx_INCREF(__pyx_t_5); __pyx_t_6 = 0;
  for (;;) {
    if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":420
 * 
 *             for i in req_ext:
 *                 if i not in extensions:             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
    if (unlikely(!__pyx_cur_scope->__pyx_v_extensions)) { __Pyx_RaiseClosureNameError("extensions"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_2 = (__Pyx_PySequence_Contains(__pyx_v_i, ((PyObject *)__pyx_cur_scope->__pyx_v_extensions), Py_NE)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = (__pyx_t_2 != 0);
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":421
 *             for i in req_ext:
 *                 if i not in extensions:
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *             return True
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":423
 *                     return False
 * 
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         # Count the number of texture units.
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.init.use_subsystem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8init(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *__pyx_cur_scope;
  GLenum __pyx_v_err;
  char *__pyx_v_renderer;
  char *__pyx_v_version;
  PyObject *__pyx_v_allow_shader = NULL;
  PyObject *__pyx_v_allow_fixed = NULL;
  PyObject *__pyx_v_r = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_v_allow_shader_ = NULL;
  PyObject *__pyx_v_allow_fixed_ = NULL;
  char *__pyx_v_extensions_string;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_use_subsystem = 0;
  GLint __pyx_v_texture_units;
  CYTHON_UNUSED PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  int __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init", 0);
  __pyx_cur_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init(__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct__init, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);

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

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

    /* "renpy/gl/gldraw.pyx":349
 * 
 *             if err != GLEW_OK:
 *                 renpy.display.log.write("Glew init failed: %s" % <char *> glewGetErrorString(err))             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)glewGetErrorString(__pyx_v_err))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __Pyx_DECREF(((PyObject *)__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 = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_4));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __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(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":350
 *             if err != GLEW_OK:
 *                 renpy.display.log.write("Glew init failed: %s" % <char *> glewGetErrorString(err))
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         # Log the GL version.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __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_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":353
 * 
 *         # Log the GL version.
 *         renderer = <char *> glGetString(GL_RENDERER)             # <<<<<<<<<<<<<<
 *         version = <char *> glGetString(GL_VERSION)
 * 
 */
  __pyx_v_renderer = ((char *)glGetString(GL_RENDERER));

  /* "renpy/gl/gldraw.pyx":354
 *         # Log the GL version.
 *         renderer = <char *> glGetString(GL_RENDERER)
 *         version = <char *> glGetString(GL_VERSION)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 */
  __pyx_v_version = ((char *)glGetString(GL_VERSION));

  /* "renpy/gl/gldraw.pyx":356
 *         version = <char *> glGetString(GL_VERSION)
 * 
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Renderer: %r", renderer)
 *         renpy.display.log.write("Version: %r", version)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBytes_FromString(((char *)glGetString(GL_VENDOR))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_16));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __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(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":357
 * 
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 *         renpy.display.log.write("Renderer: %r", renderer)             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Version: %r", version)
 *         renpy.display.log.write("Display Info: %s", self.display_info)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_renderer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __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(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":358
 *         renpy.display.log.write("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 *         renpy.display.log.write("Renderer: %r", renderer)
 *         renpy.display.log.write("Version: %r", version)             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Display Info: %s", self.display_info)
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __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(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":359
 *         renpy.display.log.write("Renderer: %r", renderer)
 *         renpy.display.log.write("Version: %r", version)
 *         renpy.display.log.write("Display Info: %s", self.display_info)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __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(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
  __Pyx_INCREF(__pyx_v_self->display_info);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_self->display_info);
  __Pyx_GIVEREF(__pyx_v_self->display_info);
  __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __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_4)); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":362
 * 
 * 
 *         allow_shader = True             # <<<<<<<<<<<<<<
 *         allow_fixed = self.allow_fixed
 * 
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_allow_shader = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":363
 * 
 *         allow_shader = True
 *         allow_fixed = self.allow_fixed             # <<<<<<<<<<<<<<
 * 
 *         for r, v, allow_shader_, allow_fixed_ in glblacklist.BLACKLIST:
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->allow_fixed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_allow_fixed = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":365
 *         allow_fixed = self.allow_fixed
 * 
 *         for r, v, allow_shader_, allow_fixed_ in glblacklist.BLACKLIST:             # <<<<<<<<<<<<<<
 *             if r in renderer and v in version:
 *                 allow_shader = allow_shader and allow_shader_
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__glblacklist); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__BLACKLIST); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_4) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_2 = __pyx_t_4; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_4 = __pyx_t_6(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = 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); 
      } else {
        __pyx_t_3 = 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_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    {
      Py_ssize_t index = -1;
      PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_7,&__pyx_t_8,&__pyx_t_9};
      __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      for (index=0; index < 4; index++) {
        PyObject* item = __pyx_t_11(__pyx_t_10); if (unlikely(!item)) goto __pyx_L6_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_allow_shader_, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_allow_fixed_, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "renpy/gl/gldraw.pyx":366
 * 
 *         for r, v, allow_shader_, allow_fixed_ in glblacklist.BLACKLIST:
 *             if r in renderer and v in version:             # <<<<<<<<<<<<<<
 *                 allow_shader = allow_shader and allow_shader_
 *                 allow_fixed = allow_fixed and allow_fixed_
 */
    __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_renderer); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_r, ((PyObject *)__pyx_t_4), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
    if ((__pyx_t_1 != 0)) {
      __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __pyx_t_12 = (__Pyx_PySequence_Contains(__pyx_v_v, ((PyObject *)__pyx_t_4), Py_EQ)); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_13 = (__pyx_t_12 != 0);
    } else {
      __pyx_t_13 = (__pyx_t_1 != 0);
    }
    if (__pyx_t_13) {

      /* "renpy/gl/gldraw.pyx":367
 *         for r, v, allow_shader_, allow_fixed_ in glblacklist.BLACKLIST:
 *             if r in renderer and v in version:
 *                 allow_shader = allow_shader and allow_shader_             # <<<<<<<<<<<<<<
 *                 allow_fixed = allow_fixed and allow_fixed_
 *                 break
 */
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_shader); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_13) {
        __Pyx_INCREF(__pyx_v_allow_shader_);
        __pyx_t_4 = __pyx_v_allow_shader_;
      } else {
        __Pyx_INCREF(__pyx_v_allow_shader);
        __pyx_t_4 = __pyx_v_allow_shader;
      }
      __Pyx_DECREF_SET(__pyx_v_allow_shader, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "renpy/gl/gldraw.pyx":368
 *             if r in renderer and v in version:
 *                 allow_shader = allow_shader and allow_shader_
 *                 allow_fixed = allow_fixed and allow_fixed_             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_13) {
        __Pyx_INCREF(__pyx_v_allow_fixed_);
        __pyx_t_4 = __pyx_v_allow_fixed_;
      } else {
        __Pyx_INCREF(__pyx_v_allow_fixed);
        __pyx_t_4 = __pyx_v_allow_fixed;
      }
      __Pyx_DECREF_SET(__pyx_v_allow_fixed, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "renpy/gl/gldraw.pyx":369
 *                 allow_shader = allow_shader and allow_shader_
 *                 allow_fixed = allow_fixed and allow_fixed_
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         if not allow_shader:
 */
      goto __pyx_L5_break;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __pyx_L5_break:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":371
 *                 break
 * 
 *         if not allow_shader:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:
 */
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_shader); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_13) != 0);
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":372
 * 
 *         if not allow_shader:
 *             renpy.display.log.write("Shaders are blacklisted.")             # <<<<<<<<<<<<<<
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "renpy/gl/gldraw.pyx":373
 *         if not allow_shader:
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((!__pyx_t_1) != 0);
  if (__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":374
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")             # <<<<<<<<<<<<<<
 * 
 *         if not allow_shader and not allow_fixed:
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L10;
  }
  __pyx_L10:;

  /* "renpy/gl/gldraw.pyx":376
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 * 
 *         if not allow_shader and not allow_fixed:             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("GL is totally blacklisted.")
 *             return False
 */
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_shader); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_13) != 0);
  if (__pyx_t_1) {
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = ((!__pyx_t_13) != 0);
    __pyx_t_13 = __pyx_t_12;
  } else {
    __pyx_t_13 = __pyx_t_1;
  }
  if (__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":377
 * 
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":378
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if ANGLE:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "renpy/gl/gldraw.pyx":383
 *             gltexture.use_gles()
 * 
 *         elif renpy.android:             # <<<<<<<<<<<<<<
 *             self.redraw_period = 1.0
 *             self.always_opaque = True
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__android); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_13) {

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

    /* "renpy/gl/gldraw.pyx":385
 *         elif renpy.android:
 *             self.redraw_period = 1.0
 *             self.always_opaque = True             # <<<<<<<<<<<<<<
 *             gltexture.use_gles()
 * 
 */
    __pyx_v_self->always_opaque = 1;

    /* "renpy/gl/gldraw.pyx":386
 *             self.redraw_period = 1.0
 *             self.always_opaque = True
 *             gltexture.use_gles()             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__use_gles); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":389
 * 
 *         else:
 *             gltexture.use_gl()             # <<<<<<<<<<<<<<
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__use_gl); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L12:;

  /* "renpy/gl/gldraw.pyx":391
 *             gltexture.use_gl()
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)             # <<<<<<<<<<<<<<
 *         extensions = set(extensions_string.split(" "))
 * 
 */
  __pyx_v_extensions_string = ((char *)glGetString(GL_EXTENSIONS));

  /* "renpy/gl/gldraw.pyx":392
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 *         extensions = set(extensions_string.split(" "))             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Extensions:")
 */
  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_extensions_string); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_4), __pyx_n_s__split); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __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 = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_cur_scope->__pyx_v_extensions = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":394
 *         extensions = set(extensions_string.split(" "))
 * 
 *         renpy.display.log.write("Extensions:")             # <<<<<<<<<<<<<<
 * 
 *         for i in sorted(extensions):
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":396
 *         renpy.display.log.write("Extensions:")
 * 
 *         for i in sorted(extensions):             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("    %s", i)
 * 
 */
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_extensions));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_cur_scope->__pyx_v_extensions));
  __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_extensions));
  __pyx_t_2 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #else
      __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      #endif
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":397
 * 
 *         for i in sorted(extensions):
 *             renpy.display.log.write("    %s", i)             # <<<<<<<<<<<<<<
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __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 = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_30));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
    __Pyx_INCREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":399
 *             renpy.display.log.write("    %s", i)
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):             # <<<<<<<<<<<<<<
 *             """
 *             Decides if we should used a particular subsystem, based on
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_4init_1use_subsystem, 0, __pyx_n_s_34, ((PyObject*)__pyx_cur_scope), __pyx_n_s_35, ((PyObject *)__pyx_k_codeobj_32)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_use_subsystem = __pyx_t_4;
  __pyx_t_4 = 0;

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

  /* "renpy/gl/gldraw.pyx":427
 *         # Count the number of texture units.
 *         cdef GLint texture_units = 0
 *         glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Number of texture units: %d", texture_units)
 */
  glGetIntegerv(GL_MAX_TEXTURE_UNITS, (&__pyx_v_texture_units));

  /* "renpy/gl/gldraw.pyx":429
 *         glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units)
 * 
 *         renpy.display.log.write("Number of texture units: %d", texture_units)             # <<<<<<<<<<<<<<
 * 
 *         # Pick a texture environment subsystem.
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_to_py_GLint(__pyx_v_texture_units); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":433
 *         # Pick a texture environment subsystem.
 * 
 *         if ANGLE or renpy.android or (allow_shader and use_subsystem(             # <<<<<<<<<<<<<<
 *             glenviron_shader,
 *             "RENPY_GL_ENVIRON",
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__android); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_13) {
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_allow_shader); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":434
 * 
 *         if ANGLE or renpy.android or (allow_shader and use_subsystem(
 *             glenviron_shader,             # <<<<<<<<<<<<<<
 *             "RENPY_GL_ENVIRON",
 *             "shader",
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_shader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_New(5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__shader));
      PyTuple_SET_ITEM(__pyx_t_4, 2, ((PyObject *)__pyx_n_s__shader));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shader));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_37));
      PyTuple_SET_ITEM(__pyx_t_4, 3, ((PyObject *)__pyx_n_s_37));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_37));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_38));
      PyTuple_SET_ITEM(__pyx_t_4, 4, ((PyObject *)__pyx_n_s_38));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_38));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_14 = __pyx_t_12;
    } else {
      __pyx_t_14 = __pyx_t_1;
    }
    __pyx_t_1 = __pyx_t_14;
  } else {
    __pyx_t_1 = __pyx_t_13;
  }
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":440
 *             "GL_ARB_fragment_shader")):
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      /*try:*/ {

        /* "renpy/gl/gldraw.pyx":441
 * 
 *             try:
 *                 renpy.display.log.write("Using shader environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "renpy/gl/gldraw.pyx":442
 *             try:
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "shader"
 *                 self.environ.init()
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_shader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__ShaderEnviron); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_v_self->environ);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
        __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_2);
        __pyx_t_2 = 0;

        /* "renpy/gl/gldraw.pyx":443
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
        if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        }
        if (PyDict_SetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__shader)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L16_error;}

        /* "renpy/gl/gldraw.pyx":444
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             except Exception, e:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s__init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      goto __pyx_L23_try_end;
      __pyx_L16_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "renpy/gl/gldraw.pyx":446
 *                 self.environ.init()
 * 
 *             except Exception, e:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Initializing shader environment failed:")
 *                 renpy.display.log.exception()
 */
      __pyx_t_18 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_18) {
        __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_2);
        __pyx_v_e = __pyx_t_2;

        /* "renpy/gl/gldraw.pyx":447
 * 
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")             # <<<<<<<<<<<<<<
 *                 renpy.display.log.exception()
 *                 self.environ = None
 */
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_42), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "renpy/gl/gldraw.pyx":448
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")
 *                 renpy.display.log.exception()             # <<<<<<<<<<<<<<
 *                 self.environ = None
 * 
 */
        __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__exception); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        __pyx_t_9 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_9);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

        /* "renpy/gl/gldraw.pyx":449
 *                 renpy.display.log.write("Initializing shader environment failed:")
 *                 renpy.display.log.exception()
 *                 self.environ = None             # <<<<<<<<<<<<<<
 * 
 *         if self.environ is None:
 */
        __Pyx_INCREF(Py_None);
        __Pyx_GIVEREF(Py_None);
        __Pyx_GOTREF(__pyx_v_self->environ);
        __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
        __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)Py_None);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L17_exception_handled;
      }
      __pyx_L18_except_error:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      goto __pyx_L1_error;
      __pyx_L17_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __pyx_L23_try_end:;
    }
    goto __pyx_L15;
  }
  __pyx_L15:;

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

    /* "renpy/gl/gldraw.pyx":453
 *         if self.environ is None:
 * 
 *             if allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_13) {

      /* "renpy/gl/gldraw.pyx":454
 * 
 *             if allow_fixed and use_subsystem(
 *                 glenviron_fixed,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "fixed",
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__fixed));
      PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__fixed));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fixed));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_43));
      PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_43));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_43));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_44));
      PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_s_44));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_44));
      __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_14 = __pyx_t_1;
    } else {
      __pyx_t_14 = __pyx_t_13;
    }
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":460
 *                 "GL_ARB_texture_env_combine"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "renpy/gl/gldraw.pyx":461
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_47); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_v_self->environ);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
      __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "renpy/gl/gldraw.pyx":462
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (PyDict_SetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__fixed)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/gl/gldraw.pyx":463
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             elif allow_fixed and use_subsystem(
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s__init); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L27;
    }

    /* "renpy/gl/gldraw.pyx":465
 *                 self.environ.init()
 * 
 *             elif allow_fixed and use_subsystem(             # <<<<<<<<<<<<<<
 *                 glenviron_fixed,
 *                 "RENPY_GL_ENVIRON",
 */
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_14) {

      /* "renpy/gl/gldraw.pyx":466
 * 
 *             elif allow_fixed and use_subsystem(
 *                 glenviron_fixed,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "fixed",
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      __Pyx_INCREF(((PyObject *)__pyx_n_s__fixed));
      PyTuple_SET_ITEM(__pyx_t_8, 2, ((PyObject *)__pyx_n_s__fixed));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fixed));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_48));
      PyTuple_SET_ITEM(__pyx_t_8, 3, ((PyObject *)__pyx_n_s_48));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_48));
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __pyx_t_13;
    } else {
      __pyx_t_1 = __pyx_t_14;
    }
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":471
 *                 "GL_NV_texture_env_combine4"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":472
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_47); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 472; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_v_self->environ);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
      __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_2);
      __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":473
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (PyDict_SetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__fixed)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/gl/gldraw.pyx":474
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             elif use_subsystem(
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s__init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L27;
    }

    /* "renpy/gl/gldraw.pyx":477
 * 
 *             elif use_subsystem(
 *                 glenviron_limited,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "limited",
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_limited); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 477; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
    __Pyx_INCREF(((PyObject *)__pyx_n_s__limited));
    PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__limited));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limited));
    __Pyx_INCREF(((PyObject *)__pyx_n_s_51));
    PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_51));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_51));
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (__pyx_t_1) {

      /* "renpy/gl/gldraw.pyx":482
 *                 "RENPY_bogus_extension"):
 * 
 *                 renpy.display.log.write("Using limited environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_53), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "renpy/gl/gldraw.pyx":483
 * 
 *                 renpy.display.log.write("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "limited"
 *                 self.environ.init()
 */
      __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__glenviron_limited); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__LimitedEnviron); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5renpy_2gl_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_v_self->environ);
      __Pyx_DECREF(((PyObject *)__pyx_v_self->environ));
      __pyx_v_self->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_8);
      __pyx_t_8 = 0;

      /* "renpy/gl/gldraw.pyx":484
 *                 renpy.display.log.write("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      if (PyDict_SetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__limited)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/gl/gldraw.pyx":485
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s__init); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L27;
    }
    /*else*/ {

      /* "renpy/gl/gldraw.pyx":488
 * 
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_55), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "renpy/gl/gldraw.pyx":489
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         # Pick a Render-to-texture method.
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L0;
    }
    __pyx_L27:;
    goto __pyx_L26;
  }
  __pyx_L26:;

  /* "renpy/gl/gldraw.pyx":493
 *         # Pick a Render-to-texture method.
 * 
 *         if glrtt_copy and os.environ.get("RENPY_GL_RTT", "copy") == "copy":             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__glrtt_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__environ); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_56), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_8, ((PyObject *)__pyx_n_s__copy), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_13 = __pyx_t_14;
  } else {
    __pyx_t_13 = __pyx_t_1;
  }
  if (__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":494
 * 
 *         if glrtt_copy and os.environ.get("RENPY_GL_RTT", "copy") == "copy":
 *             renpy.display.log.write("Using copy RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_58), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":495
 *         if glrtt_copy and os.environ.get("RENPY_GL_RTT", "copy") == "copy":
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()             # <<<<<<<<<<<<<<
 *             self.info["rtt"] = "copy"
 *             self.rtt.init()
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__glrtt_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__CopyRtt); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(__pyx_v_self->rtt);
    __Pyx_DECREF(__pyx_v_self->rtt);
    __pyx_v_self->rtt = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":496
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"             # <<<<<<<<<<<<<<
 *             self.rtt.init()
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__rtt), ((PyObject *)__pyx_n_s__copy)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/gl/gldraw.pyx":497
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"
 *             self.rtt.init()             # <<<<<<<<<<<<<<
 * 
 *         elif (use_subsystem(
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s__init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L28;
  }

  /* "renpy/gl/gldraw.pyx":500
 * 
 *         elif (use_subsystem(
 *                 glrtt_fbo,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_RTT",
 *                 "fbo",
 */
  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__glrtt_fbo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__RENPY_GL_RTT));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__fbo));
  PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__fbo));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbo));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_59));
  PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_59));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_59));
  __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (!__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":505
 *                 "GL_OES_framebuffer_object") or
 *             use_subsystem(
 *                 glrtt_fbo,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_RTT",
 *                 "fbo",
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__glrtt_fbo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
    PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__RENPY_GL_RTT));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
    __Pyx_INCREF(((PyObject *)__pyx_n_s__fbo));
    PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__fbo));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbo));
    __Pyx_INCREF(((PyObject *)__pyx_n_s_60));
    PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_60));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_60));
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_14 = __pyx_t_1;
  } else {
    __pyx_t_14 = __pyx_t_13;
  }
  if (__pyx_t_14) {

    /* "renpy/gl/gldraw.pyx":510
 *                 "GL_ARB_framebuffer_object")):
 * 
 *             renpy.display.log.write("Using FBO RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "renpy/gl/gldraw.pyx":511
 * 
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()             # <<<<<<<<<<<<<<
 *             self.info["rtt"] = "fbo"
 *             self.rtt.init()
 */
    __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__glrtt_fbo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__FboRtt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GIVEREF(__pyx_t_8);
    __Pyx_GOTREF(__pyx_v_self->rtt);
    __Pyx_DECREF(__pyx_v_self->rtt);
    __pyx_v_self->rtt = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "renpy/gl/gldraw.pyx":512
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"             # <<<<<<<<<<<<<<
 *             self.rtt.init()
 * 
 */
    if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    if (PyDict_SetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__rtt), ((PyObject *)__pyx_n_s__fbo)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/gl/gldraw.pyx":513
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 *             self.rtt.init()             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s__init); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L28;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":516
 * 
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_k_tuple_64), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":517
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")
 *             return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
  }
  __pyx_L28:;

  /* "renpy/gl/gldraw.pyx":520
 * 
 * 
 *         renpy.display.log.write("Using {0} renderer.".format(self.info["renderer"]))             # <<<<<<<<<<<<<<
 * 
 *         # Figure out the sizes of texture that render properly.
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_65), __pyx_n_s__format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(((PyObject *)__pyx_v_self->info) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_4 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_self->info), ((PyObject *)__pyx_n_s__renderer)); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __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_9)); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":523
 * 
 *         # Figure out the sizes of texture that render properly.
 *         rv = gltexture.test_texture_sizes(self.environ, self)             # <<<<<<<<<<<<<<
 * 
 *         self.rtt.deinit()
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__test_texture_sizes); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->environ));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->environ));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->environ));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  __pyx_v_rv = __pyx_t_8;
  __pyx_t_8 = 0;

  /* "renpy/gl/gldraw.pyx":525
 *         rv = gltexture.test_texture_sizes(self.environ, self)
 * 
 *         self.rtt.deinit()             # <<<<<<<<<<<<<<
 *         self.environ.deinit()
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->rtt, __pyx_n_s__deinit); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":526
 * 
 *         self.rtt.deinit()
 *         self.environ.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if not rv:
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->environ), __pyx_n_s__deinit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "renpy/gl/gldraw.pyx":528
 *         self.environ.deinit()
 * 
 *         if not rv:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_rv); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = ((!__pyx_t_14) != 0);
  if (__pyx_t_13) {

    /* "renpy/gl/gldraw.pyx":529
 * 
 *         if not rv:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # Do additional setup needed.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
    goto __pyx_L29;
  }
  __pyx_L29:;

  /* "renpy/gl/gldraw.pyx":532
 * 
 *         # Do additional setup needed.
 *         renpy.display.pgrender.set_rgba_masks()             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__set_rgba_masks); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "renpy/gl/gldraw.pyx":534
 *         renpy.display.pgrender.set_rgba_masks()
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_allow_shader);
  __Pyx_XDECREF(__pyx_v_allow_fixed);
  __Pyx_XDECREF(__pyx_v_r);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_allow_shader_);
  __Pyx_XDECREF(__pyx_v_allow_fixed_);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_use_subsystem);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11should_redraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_10should_redraw[] = "\n        Redraw whenever the screen needs it, but at least once every\n        .2 seconds. We rely on VSYNC to slow down our maximum\n        draw speed.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11should_redraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_needs_redraw = 0;
  PyObject *__pyx_v_first_pass = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("should_redraw (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__needs_redraw,&__pyx_n_s__first_pass,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__needs_redraw)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__first_pass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("should_redraw", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "should_redraw") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __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_needs_redraw = values[0];
    __pyx_v_first_pass = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("should_redraw", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.should_redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_10should_redraw(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_needs_redraw, __pyx_v_first_pass);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

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

  /* "renpy/gl/gldraw.pyx":546
 *         rv = False
 * 
 *         if needs_redraw:             # <<<<<<<<<<<<<<
 *             rv = True
 *         elif first_pass:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_needs_redraw); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

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

  /* "renpy/gl/gldraw.pyx":548
 *         if needs_redraw:
 *             rv = True
 *         elif first_pass:             # <<<<<<<<<<<<<<
 *             rv = True
 *         elif time.time() > self.last_redraw_time + self.redraw_period:
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_first_pass); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":549
 *             rv = True
 *         elif first_pass:
 *             rv = True             # <<<<<<<<<<<<<<
 *         elif time.time() > self.last_redraw_time + self.redraw_period:
 *             rv = True
 */
    __pyx_v_rv = 1;
    goto __pyx_L3;
  }

  /* "renpy/gl/gldraw.pyx":550
 *         elif first_pass:
 *             rv = True
 *         elif time.time() > self.last_redraw_time + self.redraw_period:             # <<<<<<<<<<<<<<
 *             rv = True
 *         else:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __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_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyFloat_FromDouble((__pyx_v_self->last_redraw_time + __pyx_v_self->redraw_period)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "renpy/gl/gldraw.pyx":551
 *             rv = True
 *         elif time.time() > self.last_redraw_time + self.redraw_period:
 *             rv = True             # <<<<<<<<<<<<<<
 *         else:
 *             # Redraw if the mouse moves.
 */
    __pyx_v_rv = 1;
    goto __pyx_L3;
  }
  /*else*/ {

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

    /* "renpy/gl/gldraw.pyx":555
 *             # Redraw if the mouse moves.
 *             mx, my, tex = self.mouse_info
 *             if tex and (mx, my) != pygame.mouse.get_pos():             # <<<<<<<<<<<<<<
 *                 rv = True
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_tex); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {
      __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_mx);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_mx);
      __Pyx_GIVEREF(__pyx_v_mx);
      __Pyx_INCREF(__pyx_v_my);
      PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_my);
      __Pyx_GIVEREF(__pyx_v_my);
      __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__get_pos); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __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_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __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_RichCompare(((PyObject *)__pyx_t_4), __pyx_t_2, Py_NE); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = __pyx_t_8;
    } else {
      __pyx_t_9 = __pyx_t_1;
    }
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":556
 *             mx, my, tex = self.mouse_info
 *             if tex and (mx, my) != pygame.mouse.get_pos():
 *                 rv = True             # <<<<<<<<<<<<<<
 * 
 *         # Store the redraw time.
 */
      __pyx_v_rv = 1;
      goto __pyx_L6;
    }
    __pyx_L6:;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":559
 * 
 *         # Store the redraw time.
 *         if rv:             # <<<<<<<<<<<<<<
 *             self.last_redraw_time = time.time()
 *             return True
 */
  __pyx_t_9 = (__pyx_v_rv != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":560
 *         # Store the redraw time.
 *         if rv:
 *             self.last_redraw_time = time.time()             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__time); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __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_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_self->last_redraw_time = __pyx_t_10;

    /* "renpy/gl/gldraw.pyx":561
 *         if rv:
 *             self.last_redraw_time = time.time()
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":563
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def mutated_surface(self, surf):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
  }
  __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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.should_redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mutated_surface (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12mutated_surface(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_surf));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12mutated_surface(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mutated_surface", 0);

  /* "renpy/gl/gldraw.pyx":566
 * 
 *     def mutated_surface(self, surf):
 *         if surf in self.texture_cache:             # <<<<<<<<<<<<<<
 *             del self.texture_cache[surf]
 * 
 */
  __pyx_t_1 = (__Pyx_PySequence_Contains(__pyx_v_surf, __pyx_v_self->texture_cache, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":567
 *     def mutated_surface(self, surf):
 *         if surf in self.texture_cache:
 *             del self.texture_cache[surf]             # <<<<<<<<<<<<<<
 * 
 *     def load_texture(self, surf, transient=False):
 */
    if (PyObject_DelItem(__pyx_v_self->texture_cache, __pyx_v_surf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15load_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_14load_texture[] = "\n        Loads a texture into memory.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15load_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surf = 0;
  PyObject *__pyx_v_transient = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("load_texture (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surf,&__pyx_n_s__transient,0};
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_66;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__surf)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__transient);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "load_texture") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __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_surf = values[0];
    __pyx_v_transient = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("load_texture", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.load_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_14load_texture(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surf, __pyx_v_transient);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_14load_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surf, PyObject *__pyx_v_transient) {
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("load_texture", 0);

  /* "renpy/gl/gldraw.pyx":576
 *         # Turn a surface into a texture grid.
 * 
 *         rv = self.texture_cache.get(surf, None)             # <<<<<<<<<<<<<<
 * 
 *         if rv is None:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->texture_cache, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __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 = 576; __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_v_rv = __pyx_t_3;
  __pyx_t_3 = 0;

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

    /* "renpy/gl/gldraw.pyx":579
 * 
 *         if rv is None:
 *             rv = gltexture.texture_grid_from_surface(surf, transient)             # <<<<<<<<<<<<<<
 *             self.texture_cache[surf] = rv
 * 
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_67); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __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(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__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(__pyx_v_transient);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_transient);
    __Pyx_GIVEREF(__pyx_v_transient);
    __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 = 579; __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_DECREF_SET(__pyx_v_rv, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":580
 *         if rv is None:
 *             rv = gltexture.texture_grid_from_surface(surf, transient)
 *             self.texture_cache[surf] = rv             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
    if (PyObject_SetItem(__pyx_v_self->texture_cache, __pyx_v_surf, __pyx_v_rv) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":582
 *             self.texture_cache[surf] = rv
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def solid_texture(self, w, h, color):
 */
  __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_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.load_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17solid_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17solid_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_color = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("solid_texture (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__w,&__pyx_n_s__h,&__pyx_n_s__color,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "solid_texture") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __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_w = values[0];
    __pyx_v_h = values[1];
    __pyx_v_color = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.solid_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_16solid_texture(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_w, __pyx_v_h, __pyx_v_color);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_16solid_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_w, PyObject *__pyx_v_h, PyObject *__pyx_v_color) {
  PyObject *__pyx_v_surf = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("solid_texture", 0);

  /* "renpy/gl/gldraw.pyx":585
 * 
 *     def solid_texture(self, w, h, color):
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)             # <<<<<<<<<<<<<<
 *         surf.fill(color)
 *         surf = surf.subsurface((2, 2, w, h))
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__surface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Add(__pyx_v_w, __pyx_int_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Add(__pyx_v_h, __pyx_int_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __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 = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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 = 585; __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 = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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 = 585; __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/gl/gldraw.pyx":586
 *     def solid_texture(self, w, h, color):
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)
 *         surf.fill(color)             # <<<<<<<<<<<<<<
 *         surf = surf.subsurface((2, 2, w, h))
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s__fill); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __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 = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_color);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_color);
  __Pyx_GIVEREF(__pyx_v_color);
  __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 = 586; __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/gl/gldraw.pyx":587
 *         surf = renpy.display.pgrender.surface((w + 4, h + 4), True)
 *         surf.fill(color)
 *         surf = surf.subsurface((2, 2, w, h))             # <<<<<<<<<<<<<<
 * 
 *         return self.load_texture(surf)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_surf, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  __Pyx_INCREF(__pyx_int_2);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_2);
  __Pyx_GIVEREF(__pyx_int_2);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __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 = 587; __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_DECREF_SET(__pyx_v_surf, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":589
 *         surf = surf.subsurface((2, 2, w, h))
 * 
 *         return self.load_texture(surf)             # <<<<<<<<<<<<<<
 * 
 *     # private
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__load_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  __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 = 589; __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_r = __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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.solid_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_surf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

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

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

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

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

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_21clip_mode_rtt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_20clip_mode_rtt[] = "\n        The same thing, except the screen is projected in RTT mode.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_21clip_mode_rtt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clip_mode_rtt (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__w,&__pyx_n_s__h,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "clip_mode_rtt") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("clip_mode_rtt", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.clip_mode_rtt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_20clip_mode_rtt(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_20clip_mode_rtt(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clip_mode_rtt", 0);

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

  /* "renpy/gl/gldraw.pyx":612
 * 
 *         self.clip_cache = None
 *         self.clip_rtt_box = (x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *         self.environ.unset_clip(self)
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->clip_rtt_box);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->clip_rtt_box));
  __pyx_v_self->clip_rtt_box = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

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

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

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

static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static PyObject *__pyx_f_5renpy_2gl_6gldraw_6GLDraw_set_clip(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_clip", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_clip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23set_clip)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); 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_INCREF(((PyObject *)__pyx_v_clip));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_clip));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_clip));
      __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 = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __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/gl/gldraw.pyx":619
 *     cpdef set_clip(GLDraw self, tuple clip):
 * 
 *         if self.clip_cache == clip:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_self->clip_cache), ((PyObject *)__pyx_v_clip), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

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

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

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

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip) {
  CYTHON_UNUSED int __pyx_lineno = 0;
  CYTHON_UNUSED const char *__pyx_filename = NULL;
  CYTHON_UNUSED int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_clip (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_clip), (&PyTuple_Type), 1, "clip", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_22set_clip(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject*)__pyx_v_clip));
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_22set_clip(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_clip", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 1); 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_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.gl.gldraw.GLDraw.set_clip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_25draw_screen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_24draw_screen[] = "\n        Draws the screen.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_25draw_screen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surftree = 0;
  CYTHON_UNUSED PyObject *__pyx_v_fullscreen_video = 0;
  PyObject *__pyx_v_flip = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_screen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surftree,&__pyx_n_s__fullscreen_video,&__pyx_n_s__flip,0};
    PyObject* values[3] = {0,0,0};
    values[2] = __pyx_k_68;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__surftree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fullscreen_video)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_screen", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flip);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_screen") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      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);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_surftree = values[0];
    __pyx_v_fullscreen_video = values[1];
    __pyx_v_flip = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_screen", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_screen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_24draw_screen(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surftree, __pyx_v_fullscreen_video, __pyx_v_flip);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_24draw_screen(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, CYTHON_UNUSED PyObject *__pyx_v_fullscreen_video, PyObject *__pyx_v_flip) {
  CYTHON_UNUSED PyObject *__pyx_v_forward = NULL;
  PyObject *__pyx_v_reverse = NULL;
  PyObject *__pyx_v_clip = NULL;
  PyObject *__pyx_v_surf = 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;
  int __pyx_t_5;
  int __pyx_t_6;
  double __pyx_t_7;
  double __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_screen", 0);

  /* "renpy/gl/gldraw.pyx":632
 *         """
 * 
 *         forward = reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         surftree.is_opaque()
 */
  __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_v_forward = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_v_reverse = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;

  /* "renpy/gl/gldraw.pyx":634
 *         forward = reverse = IDENTITY
 * 
 *         surftree.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         self.draw_render_textures(surftree, 0)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_surftree, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __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 = 634; __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/gl/gldraw.pyx":636
 *         surftree.is_opaque()
 * 
 *         self.draw_render_textures(surftree, 0)             # <<<<<<<<<<<<<<
 * 
 *         self.environ.viewport(self.physical_box[0], self.physical_box[1], self.physical_box[2], self.physical_box[3])
 */
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_render_textures(__pyx_v_self, __pyx_v_surftree, 0, 0);

  /* "renpy/gl/gldraw.pyx":638
 *         self.draw_render_textures(surftree, 0)
 * 
 *         self.environ.viewport(self.physical_box[0], self.physical_box[1], self.physical_box[2], self.physical_box[3])             # <<<<<<<<<<<<<<
 *         self.environ.ortho(0, self.virtual_size[0], self.virtual_size[1], 0, -1.0, 1.0)
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->physical_box) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->physical_box), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(((PyObject *)__pyx_v_self->physical_box) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->physical_box), 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(((PyObject *)__pyx_v_self->physical_box) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->physical_box), 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(((PyObject *)__pyx_v_self->physical_box) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->physical_box), 3, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->viewport(__pyx_v_self->environ, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6);

  /* "renpy/gl/gldraw.pyx":639
 * 
 *         self.environ.viewport(self.physical_box[0], self.physical_box[1], self.physical_box[2], self.physical_box[3])
 *         self.environ.ortho(0, self.virtual_size[0], self.virtual_size[1], 0, -1.0, 1.0)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_screen()
 */
  if (unlikely(((PyObject *)__pyx_v_self->virtual_size) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->virtual_size), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(((PyObject *)__pyx_v_self->virtual_size) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->virtual_size), 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->ortho(__pyx_v_self->environ, 0.0, __pyx_t_7, __pyx_t_8, 0.0, -1.0, 1.0);

  /* "renpy/gl/gldraw.pyx":641
 *         self.environ.ortho(0, self.virtual_size[0], self.virtual_size[1], 0, -1.0, 1.0)
 * 
 *         self.clip_mode_screen()             # <<<<<<<<<<<<<<
 * 
 *         glClearColor(0.0, 0.0, 0.0, 1.0)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__clip_mode_screen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __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 = 641; __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/gl/gldraw.pyx":643
 *         self.clip_mode_screen()
 * 
 *         glClearColor(0.0, 0.0, 0.0, 1.0)             # <<<<<<<<<<<<<<
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 */
  glClearColor(0.0, 0.0, 0.0, 1.0);

  /* "renpy/gl/gldraw.pyx":644
 * 
 *         glClearColor(0.0, 0.0, 0.0, 1.0)
 *         glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *         self.default_clip = (0, 0, self.virtual_size[0], self.virtual_size[1])
 */
  glClear(GL_COLOR_BUFFER_BIT);

  /* "renpy/gl/gldraw.pyx":646
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 *         self.default_clip = (0, 0, self.virtual_size[0], self.virtual_size[1])             # <<<<<<<<<<<<<<
 *         clip = self.default_clip
 * 
 */
  if (unlikely(((PyObject *)__pyx_v_self->virtual_size) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->virtual_size), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (unlikely(((PyObject *)__pyx_v_self->virtual_size) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->virtual_size), 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyTuple_New(4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_9, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __Pyx_GIVEREF(((PyObject *)__pyx_t_9));
  __Pyx_GOTREF(__pyx_v_self->default_clip);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->default_clip));
  __pyx_v_self->default_clip = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "renpy/gl/gldraw.pyx":647
 * 
 *         self.default_clip = (0, 0, self.virtual_size[0], self.virtual_size[1])
 *         clip = self.default_clip             # <<<<<<<<<<<<<<
 * 
 *         self.upscale_factor = 1.0 * self.physical_size[0] / self.virtual_size[0]
 */
  __pyx_t_9 = ((PyObject *)__pyx_v_self->default_clip);
  __Pyx_INCREF(__pyx_t_9);
  __pyx_v_clip = ((PyObject*)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "renpy/gl/gldraw.pyx":649
 *         clip = self.default_clip
 * 
 *         self.upscale_factor = 1.0 * self.physical_size[0] / self.virtual_size[0]             # <<<<<<<<<<<<<<
 * 
 *         if renpy.audio.music.get_playing("movie") and renpy.display.video.fullscreen:
 */
  __pyx_t_9 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  if (unlikely(((PyObject *)__pyx_v_self->physical_size) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->physical_size), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_1 = PyNumber_Multiply(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(((PyObject *)__pyx_v_self->virtual_size) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->virtual_size), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__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_9 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_v_self->upscale_factor = __pyx_t_8;

  /* "renpy/gl/gldraw.pyx":651
 *         self.upscale_factor = 1.0 * self.physical_size[0] / self.virtual_size[0]
 * 
 *         if renpy.audio.music.get_playing("movie") and renpy.display.video.fullscreen:             # <<<<<<<<<<<<<<
 *             surf = renpy.display.video.render_movie(self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:
 */
  __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__audio); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__music); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__get_playing); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_10) {
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__video); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__fullscreen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_12 = __pyx_t_11;
  } else {
    __pyx_t_12 = __pyx_t_10;
  }
  if (__pyx_t_12) {

    /* "renpy/gl/gldraw.pyx":652
 * 
 *         if renpy.audio.music.get_playing("movie") and renpy.display.video.fullscreen:
 *             surf = renpy.display.video.render_movie(self.virtual_size[0], self.virtual_size[1])             # <<<<<<<<<<<<<<
 *             if surf is not None:
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse)
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__video); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__render_movie); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(((PyObject *)__pyx_v_self->virtual_size) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->virtual_size), 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (unlikely(((PyObject *)__pyx_v_self->virtual_size) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)__pyx_v_self->virtual_size), 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
    __pyx_v_surf = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":653
 *         if renpy.audio.music.get_playing("movie") and renpy.display.video.fullscreen:
 *             surf = renpy.display.video.render_movie(self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse)
 * 
 */
    __pyx_t_12 = (__pyx_v_surf != Py_None);
    __pyx_t_10 = (__pyx_t_12 != 0);
    if (__pyx_t_10) {

      /* "renpy/gl/gldraw.pyx":654
 *             surf = renpy.display.video.render_movie(self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:
 *                 self.draw_transformed(surf, clip, 0, 0, 1.0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
      if (!(likely(((__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_reverse, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_surf, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse), 0);
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":657
 * 
 *         else:
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         if flip:
 */
    if (!(likely(((__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_reverse, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_surftree, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse), 0);
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":659
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, 1.0, reverse)
 * 
 *         if flip:             # <<<<<<<<<<<<<<
 * 
 *             self.draw_mouse()
 */
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_v_flip); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_10) {

    /* "renpy/gl/gldraw.pyx":661
 *         if flip:
 * 
 *             self.draw_mouse()             # <<<<<<<<<<<<<<
 * 
 *             IF not ANGLE:
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__draw_mouse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "renpy/gl/gldraw.pyx":664
 * 
 *             IF not ANGLE:
 *                 pygame.display.flip()             # <<<<<<<<<<<<<<
 *             ELSE:
 *                 egl_swap()
 */
    __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__flip); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "renpy/gl/gldraw.pyx":668
 *                 egl_swap()
 * 
 *         gltexture.cleanup()             # <<<<<<<<<<<<<<
 * 
 *         gl_check("draw_screen")
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__cleanup); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":670
 *         gltexture.cleanup()
 * 
 *         gl_check("draw_screen")             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned):
 */
  __pyx_t_1 = __pyx_f_5renpy_2gl_2gl_gl_check(((PyObject *)__pyx_n_s__draw_screen)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __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_9);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_screen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_forward);
  __Pyx_XDECREF(__pyx_v_reverse);
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XDECREF(__pyx_v_surf);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":672
 *         gl_check("draw_screen")
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned):             # <<<<<<<<<<<<<<
 *         """
 *         This is responsible for rendering things to textures,
 */

static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_render_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, int __pyx_v_non_aligned, int __pyx_skip_dispatch) {
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rend = 0;
  int __pyx_v_render_what;
  int __pyx_v_first;
  PyObject *__pyx_v_child = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_cxo = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_cyo = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_pc = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_render_textures", 0);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_70); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27draw_render_textures)) {
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_non_aligned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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 = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_what);
      __Pyx_GIVEREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __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 = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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/gl/gldraw.pyx":681
 *         cdef bint render_what
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_what, ((PyObject*)__pyx_ptype_5renpy_7display_6render_Render)); 
  __pyx_t_6 = ((!(__pyx_t_5 != 0)) != 0);
  if (__pyx_t_6) {

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

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

  /* "renpy/gl/gldraw.pyx":686
 *         rend = <render.Render> what
 * 
 *         render_what = False             # <<<<<<<<<<<<<<
 * 
 *         if rend.clipping and non_aligned:
 */
  __pyx_v_render_what = 0;

  /* "renpy/gl/gldraw.pyx":688
 *         render_what = False
 * 
 *         if rend.clipping and non_aligned:             # <<<<<<<<<<<<<<
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:
 *                 render_what = True
 */
  if ((__pyx_v_rend->clipping != 0)) {
    __pyx_t_6 = (__pyx_v_non_aligned != 0);
  } else {
    __pyx_t_6 = (__pyx_v_rend->clipping != 0);
  }
  if (__pyx_t_6) {

    /* "renpy/gl/gldraw.pyx":689
 * 
 *         if rend.clipping and non_aligned:
 *             if rend.forward.xdy != 0 or rend.forward.ydx != 0:             # <<<<<<<<<<<<<<
 *                 render_what = True
 *                 non_aligned = False
 */
    __pyx_t_6 = ((__pyx_v_rend->forward->xdy != 0.0) != 0);
    if (!__pyx_t_6) {
      __pyx_t_5 = ((__pyx_v_rend->forward->ydx != 0.0) != 0);
      __pyx_t_7 = __pyx_t_5;
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (__pyx_t_7) {

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

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

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

  /* "renpy/gl/gldraw.pyx":695
 *         first = True
 * 
 *         if rend.forward:             # <<<<<<<<<<<<<<
 *             non_aligned |= (rend.forward.xdy != 0)
 *             non_aligned |= (rend.forward.ydy != 0)
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_rend->forward)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

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

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

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

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

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

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

        /* "renpy/gl/gldraw.pyx":705
 *             if rend.operation == DISSOLVE:
 *                 if not self.fast_dissolve:
 *                     child.render_to_texture(what.operation_alpha)             # <<<<<<<<<<<<<<
 * 
 *             elif rend.operation == IMAGEDISSOLVE:
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L12;
      }
      __pyx_L12:;
      goto __pyx_L11;
    }

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

      /* "renpy/gl/gldraw.pyx":708
 * 
 *             elif rend.operation == IMAGEDISSOLVE:
 *                 child.render_to_texture(first or what.operation_alpha)             # <<<<<<<<<<<<<<
 *                 first = False
 * 
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_child, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = __Pyx_PyBool_FromLong(__pyx_v_first); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (!__pyx_t_7) {
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_10 = __pyx_t_2;
        __pyx_t_2 = 0;
      } else {
        __pyx_t_10 = __pyx_t_11;
        __pyx_t_11 = 0;
      }
      __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

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

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

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

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

      /* "renpy/gl/gldraw.pyx":715
 *                 pc = child
 * 
 *                 while p > 1:             # <<<<<<<<<<<<<<
 *                     p /= 2
 *                     pc = self.get_half(pc)
 */
      while (1) {
        __pyx_t_10 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (!__pyx_t_7) break;

        /* "renpy/gl/gldraw.pyx":716
 * 
 *                 while p > 1:
 *                     p /= 2             # <<<<<<<<<<<<<<
 *                     pc = self.get_half(pc)
 * 
 */
        __pyx_t_10 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_p, __pyx_int_2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_10);
        __pyx_t_10 = 0;

        /* "renpy/gl/gldraw.pyx":717
 *                 while p > 1:
 *                     p /= 2
 *                     pc = self.get_half(pc)             # <<<<<<<<<<<<<<
 * 
 *         if render_what:
 */
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_half); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_v_pc);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_pc);
        __Pyx_GIVEREF(__pyx_v_pc);
        __pyx_t_12 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
        __Pyx_DECREF_SET(__pyx_v_pc, __pyx_t_12);
        __pyx_t_12 = 0;
      }
      goto __pyx_L11;
    }
    __pyx_L11:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":719
 *                     pc = self.get_half(pc)
 * 
 *         if render_what:             # <<<<<<<<<<<<<<
 *             what.render_to_texture(True)
 * 
 */
  __pyx_t_7 = (__pyx_v_render_what != 0);
  if (__pyx_t_7) {

    /* "renpy/gl/gldraw.pyx":720
 * 
 *         if render_what:
 *             what.render_to_texture(True)             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_transformed(
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L15;
  }
  __pyx_L15:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_WriteUnraisable("renpy.gl.gldraw.GLDraw.draw_render_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rend);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_cxo);
  __Pyx_XDECREF(__pyx_v_cyo);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_26draw_render_textures[] = "\n        This is responsible for rendering things to textures,\n        as necessary.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  int __pyx_v_non_aligned;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_render_textures (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__non_aligned,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__non_aligned)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_render_textures", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_render_textures") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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_what = values[0];
    __pyx_v_non_aligned = __Pyx_PyObject_IsTrue(values[1]); if (unlikely((__pyx_v_non_aligned == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_render_textures", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_render_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_26draw_render_textures(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_non_aligned);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":672
 *         gl_check("draw_screen")
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned):             # <<<<<<<<<<<<<<
 *         """
 *         This is responsible for rendering things to textures,
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_26draw_render_textures(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, int __pyx_v_non_aligned) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_render_textures", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_render_textures(__pyx_v_self, __pyx_v_what, __pyx_v_non_aligned, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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.gl.gldraw.GLDraw.draw_render_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_transformed(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_clip, double __pyx_v_xo, double __pyx_v_yo, double __pyx_v_alpha, double __pyx_v_over, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse, int __pyx_skip_dispatch) {
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rend = 0;
  double __pyx_v_cxo;
  double __pyx_v_cyo;
  double __pyx_v_tcxo;
  double __pyx_v_tcyo;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_child_reverse = 0;
  PyObject *__pyx_v_tex = NULL;
  PyObject *__pyx_v_p = NULL;
  PyObject *__pyx_v_pc = NULL;
  PyObject *__pyx_v_minx = NULL;
  PyObject *__pyx_v_miny = NULL;
  PyObject *__pyx_v_maxx = NULL;
  PyObject *__pyx_v_maxy = NULL;
  PyObject *__pyx_v_tw = NULL;
  PyObject *__pyx_v_th = NULL;
  PyObject *__pyx_v_child = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_focus = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_main = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  double __pyx_t_10;
  int __pyx_t_11;
  PyObject *(*__pyx_t_12)(PyObject *);
  double __pyx_t_13;
  Py_ssize_t __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_transformed", 0);
  __Pyx_INCREF(__pyx_v_clip);
  __Pyx_INCREF((PyObject *)__pyx_v_reverse);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overridden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__draw_transformed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_transformed)) {
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_over); 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_6 = PyTuple_New(7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_what);
      __Pyx_GIVEREF(__pyx_v_what);
      __Pyx_INCREF(((PyObject *)__pyx_v_clip));
      PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_clip));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_clip));
      PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_6, 5, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_INCREF(((PyObject *)__pyx_v_reverse));
      PyTuple_SET_ITEM(__pyx_t_6, 6, ((PyObject *)__pyx_v_reverse));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_reverse));
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); 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_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_r = __pyx_t_7;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "renpy/gl/gldraw.pyx":736
 *         cdef render.Matrix2D child_reverse
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, gltexture.TextureGrid):
 */
  __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_what, ((PyObject*)__pyx_ptype_5renpy_7display_6render_Render)); 
  __pyx_t_9 = ((!(__pyx_t_8 != 0)) != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":738
 *         if not isinstance(what, render.Render):
 * 
 *             if isinstance(what, gltexture.TextureGrid):             # <<<<<<<<<<<<<<
 * 
 *                 self.set_clip(clip)
 */
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_what, ((PyObject*)__pyx_ptype_5renpy_2gl_9gltexture_TextureGrid)); 
    __pyx_t_8 = (__pyx_t_9 != 0);
    if (__pyx_t_8) {

      /* "renpy/gl/gldraw.pyx":740
 *             if isinstance(what, gltexture.TextureGrid):
 * 
 *                 self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *                 gltexture.blit(
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

      /* "renpy/gl/gldraw.pyx":750
 *                     over,
 *                     self.environ,
 *                     False)             # <<<<<<<<<<<<<<
 * 
 *                 return 0
 */
      __pyx_t_5 = __pyx_f_5renpy_2gl_9gltexture_blit(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_v_what), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_1), 0, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

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

    /* "renpy/gl/gldraw.pyx":754
 *                 return 0
 * 
 *             if isinstance(what, pygame.Surface):             # <<<<<<<<<<<<<<
 * 
 *                 tex = self.load_texture(what)
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__Surface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_8 = PyObject_IsInstance(__pyx_v_what, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_9 = (__pyx_t_8 != 0);
    if (__pyx_t_9) {

      /* "renpy/gl/gldraw.pyx":756
 *             if isinstance(what, pygame.Surface):
 * 
 *                 tex = self.load_texture(what)             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse)
 *                 return 0
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__load_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __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 = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_what);
      __Pyx_GIVEREF(__pyx_v_what);
      __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      __pyx_v_tex = __pyx_t_6;
      __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":757
 * 
 *                 tex = self.load_texture(what)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse)             # <<<<<<<<<<<<<<
 *                 return 0
 * 
 */
      ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_tex, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, 0);

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

    /* "renpy/gl/gldraw.pyx":760
 *                 return 0
 * 
 *             raise Exception("Unknown drawing type. " + repr(what))             # <<<<<<<<<<<<<<
 * 
 *         rend = what
 */
    __pyx_t_6 = PyObject_Repr(__pyx_v_what); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_71), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":762
 *             raise Exception("Unknown drawing type. " + repr(what))
 * 
 *         rend = what             # <<<<<<<<<<<<<<
 * 
 *         # Other draw modes.
 */
  if (!(likely(((__pyx_v_what) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_what, __pyx_ptype_5renpy_7display_6render_Render))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_what);
  __pyx_v_rend = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_what);

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

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

      /* "renpy/gl/gldraw.pyx":774
 *                 # of dissolve on Ren'Py proper.
 * 
 *                 self.draw_transformed(rend.children[0][0],             # <<<<<<<<<<<<<<
 *                                       clip, xo, yo, alpha, over, reverse)
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/gl/gldraw.pyx":775
 * 
 *                 self.draw_transformed(rend.children[0][0],
 *                                       clip, xo, yo, alpha, over, reverse)             # <<<<<<<<<<<<<<
 * 
 *                 self.draw_transformed(rend.children[1][0],
 */
      ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_t_6, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, 0);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":777
 *                                       clip, xo, yo, alpha, over, reverse)
 * 
 *                 self.draw_transformed(rend.children[1][0],             # <<<<<<<<<<<<<<
 *                                       clip, xo, yo, alpha * what.operation_complete, over, reverse)
 * 
 */
      if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_6, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "renpy/gl/gldraw.pyx":778
 * 
 *                 self.draw_transformed(rend.children[1][0],
 *                                       clip, xo, yo, alpha * what.operation_complete, over, reverse)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      __pyx_t_6 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__operation_complete); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_t_5, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_t_10, __pyx_v_over, __pyx_v_reverse, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "renpy/gl/gldraw.pyx":782
 *             else:
 * 
 *                 self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *                 gltexture.blend(
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/gl/gldraw.pyx":785
 * 
 *                 gltexture.blend(
 *                     rend.children[0][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                     rend.children[1][0].render_to_texture(what.operation_alpha),
 *                     xo,
 */
      if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/gl/gldraw.pyx":786
 *                 gltexture.blend(
 *                     rend.children[0][0].render_to_texture(what.operation_alpha),
 *                     rend.children[1][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                     xo,
 *                     yo,
 */
      if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/gl/gldraw.pyx":793
 *                     over,
 *                     rend.operation_complete,
 *                     self.environ)             # <<<<<<<<<<<<<<
 * 
 *             return 0
 */
      __pyx_t_6 = ((PyObject *)__pyx_v_self->environ);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_1 = __pyx_f_5renpy_2gl_9gltexture_blend(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_4), ((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_5), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, __pyx_v_rend->operation_complete, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_6), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L7:;

    /* "renpy/gl/gldraw.pyx":795
 *                     self.environ)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         elif rend.operation == IMAGEDISSOLVE:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }

  /* "renpy/gl/gldraw.pyx":797
 *             return 0
 * 
 *         elif rend.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             self.set_clip(clip)
 */
  __pyx_t_9 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_IMAGEDISSOLVE) != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":799
 *         elif rend.operation == IMAGEDISSOLVE:
 * 
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             gltexture.imageblend(
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":802
 * 
 *             gltexture.imageblend(
 *                 rend.children[0][0].render_to_texture(True),             # <<<<<<<<<<<<<<
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),
 */
    if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/gl/gldraw.pyx":803
 *             gltexture.imageblend(
 *                 rend.children[0][0].render_to_texture(True),
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),
 *                 xo,
 */
    if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 1, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_5, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __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_4)); __pyx_t_4 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/gl/gldraw.pyx":804
 *                 rend.children[0][0].render_to_texture(True),
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                 xo,
 *                 yo,
 */
    if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 2, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__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_5 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__render_to_texture); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __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_3)); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/gl/gldraw.pyx":811
 *                 over,
 *                 rend.operation_complete,
 *                 rend.operation_parameter,             # <<<<<<<<<<<<<<
 *                 self.environ)
 * 
 */
    __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_v_rend->operation_parameter); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/gl/gldraw.pyx":812
 *                 rend.operation_complete,
 *                 rend.operation_parameter,
 *                 self.environ)             # <<<<<<<<<<<<<<
 * 
 *             return 0
 */
    __pyx_t_3 = ((PyObject *)__pyx_v_self->environ);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_f_5renpy_2gl_9gltexture_imageblend(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_6), ((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_1), ((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_t_5), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, __pyx_v_rend->operation_complete, __pyx_t_7, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_3), 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":814
 *                 self.environ)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/gl/gldraw.pyx":817
 * 
 * 
 *         if rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *             self.set_clip(clip)
 * 
 */
  __pyx_t_9 = ((__pyx_v_rend->operation == __pyx_v_5renpy_2gl_6gldraw_PIXELLATE) != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":818
 * 
 *         if rend.operation == PIXELLATE:
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             p = rend.operation_parameter
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":820
 *             self.set_clip(clip)
 * 
 *             p = rend.operation_parameter             # <<<<<<<<<<<<<<
 *             pc = rend.children[0][0]
 * 
 */
    __pyx_t_4 = __pyx_v_rend->operation_parameter;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_v_p = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":821
 * 
 *             p = rend.operation_parameter
 *             pc = rend.children[0][0]             # <<<<<<<<<<<<<<
 * 
 *             while p > 1:
 */
    if (unlikely(((PyObject *)__pyx_v_rend->children) == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong, 1, 0, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_pc = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":823
 *             pc = rend.children[0][0]
 * 
 *             while p > 1:             # <<<<<<<<<<<<<<
 *                 p /= 2
 *                 pc = self.get_half(pc)
 */
    while (1) {
      __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_9) break;

      /* "renpy/gl/gldraw.pyx":824
 * 
 *             while p > 1:
 *                 p /= 2             # <<<<<<<<<<<<<<
 *                 pc = self.get_half(pc)
 * 
 */
      __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_p, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_p, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "renpy/gl/gldraw.pyx":825
 *             while p > 1:
 *                 p /= 2
 *                 pc = self.get_half(pc)             # <<<<<<<<<<<<<<
 * 
 *             reverse *= renpy.display.render.Matrix2D(1.0 * what.width / pc.width, 0, 0, 1.0 * what.height / pc.height)
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_half); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_pc);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_pc);
      __Pyx_GIVEREF(__pyx_v_pc);
      __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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_pc, __pyx_t_5);
      __pyx_t_5 = 0;
    }

    /* "renpy/gl/gldraw.pyx":827
 *                 pc = self.get_half(pc)
 * 
 *             reverse *= renpy.display.render.Matrix2D(1.0 * what.width / pc.width, 0, 0, 1.0 * what.height / pc.height)             # <<<<<<<<<<<<<<
 * 
 *             gltexture.blit(
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__render); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__Matrix2D); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_pc, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __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_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pc, __pyx_n_s__height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __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 = 827; __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_t_1 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_reverse), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF_SET(__pyx_v_reverse, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":830
 * 
 *             gltexture.blit(
 *                 pc,             # <<<<<<<<<<<<<<
 *                 xo,
 *                 yo,
 */
    if (!(likely(((__pyx_v_pc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pc, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

    /* "renpy/gl/gldraw.pyx":837
 *                 over,
 *                 self.environ,
 *                 True)             # <<<<<<<<<<<<<<
 * 
 *             return 0
 */
    __pyx_t_3 = __pyx_f_5renpy_2gl_9gltexture_blit(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_v_pc), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_1), 1, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":839
 *                 True)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "renpy/gl/gldraw.pyx":843
 * 
 *         # Compute clipping.
 *         if rend.clipping:             # <<<<<<<<<<<<<<
 * 
 *             # Non-aligned clipping uses RTT.
 */
  __pyx_t_9 = (__pyx_v_rend->clipping != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":846
 * 
 *             # Non-aligned clipping uses RTT.
 *             if reverse.ydx != 0 or reverse.xdy != 0:             # <<<<<<<<<<<<<<
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse)
 */
    __pyx_t_9 = ((__pyx_v_reverse->ydx != 0.0) != 0);
    if (!__pyx_t_9) {
      __pyx_t_8 = ((__pyx_v_reverse->xdy != 0.0) != 0);
      __pyx_t_11 = __pyx_t_8;
    } else {
      __pyx_t_11 = __pyx_t_9;
    }
    if (__pyx_t_11) {

      /* "renpy/gl/gldraw.pyx":847
 *             # Non-aligned clipping uses RTT.
 *             if reverse.ydx != 0 or reverse.xdy != 0:
 *                 tex = what.render_to_texture(True)             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse)
 *                 return 0
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      __pyx_v_tex = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "renpy/gl/gldraw.pyx":848
 *             if reverse.ydx != 0 or reverse.xdy != 0:
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse)             # <<<<<<<<<<<<<<
 *                 return 0
 * 
 */
      ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_tex, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, 0);

      /* "renpy/gl/gldraw.pyx":849
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse)
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *             minx, miny, maxx, maxy = clip
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "renpy/gl/gldraw.pyx":851
 *                 return 0
 * 
 *             minx, miny, maxx, maxy = clip             # <<<<<<<<<<<<<<
 * 
 *             # Figure out the transformed width and height of this
 */
    if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_clip)))) {
      PyObject* sequence = ((PyObject *)__pyx_v_clip);
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 4)) {
        if (size > 4) __Pyx_RaiseTooManyValuesError(4);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      #else
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_3,&__pyx_t_5};
      for (i=0; i < 4; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
      #endif
    } else if (1) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else
    {
      Py_ssize_t index = -1;
      PyObject** temps[4] = {&__pyx_t_1,&__pyx_t_4,&__pyx_t_3,&__pyx_t_5};
      __pyx_t_6 = PyObject_GetIter(((PyObject *)__pyx_v_clip)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext;
      for (index=0; index < 4; index++) {
        PyObject* item = __pyx_t_12(__pyx_t_6); if (unlikely(!item)) goto __pyx_L13_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_6), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L14_unpacking_done;
      __pyx_L13_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L14_unpacking_done:;
    }
    __pyx_v_minx = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_miny = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_maxx = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_maxy = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":855
 *             # Figure out the transformed width and height of this
 *             # surface.
 *             tw, th = reverse.transform(what.width, what.height)             # <<<<<<<<<<<<<<
 * 
 *             minx = max(minx, min(xo, xo + tw))
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse->__pyx_vtab)->transform(__pyx_v_reverse, __pyx_t_10, __pyx_t_13, 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(PyTuple_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      #else
      __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else if (1) {
      __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    } else
    {
      Py_ssize_t index = -1;
      __pyx_t_1 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_3)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_4 = __pyx_t_12(__pyx_t_1); if (unlikely(!__pyx_t_4)) goto __pyx_L15_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_1), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L16_unpacking_done;
      __pyx_L15_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L16_unpacking_done:;
    }
    __pyx_v_tw = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_th = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":857
 *             tw, th = reverse.transform(what.width, what.height)
 * 
 *             minx = max(minx, min(xo, xo + tw))             # <<<<<<<<<<<<<<
 *             maxx = min(maxx, max(xo, xo + tw))
 *             miny = max(miny, min(yo, yo + th))
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Add(__pyx_t_5, __pyx_v_tw); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_13 = __pyx_v_xo;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = __pyx_t_4;
    } else {
      __pyx_t_1 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_4 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_v_minx);
    __pyx_t_5 = __pyx_v_minx;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_1 = __pyx_t_4;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_1 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __pyx_t_1;
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_minx, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":858
 * 
 *             minx = max(minx, min(xo, xo + tw))
 *             maxx = min(maxx, max(xo, xo + tw))             # <<<<<<<<<<<<<<
 *             miny = max(miny, min(yo, yo + th))
 *             maxy = min(maxy, max(yo, yo + th))
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_v_tw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_13 = __pyx_v_xo;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_4 = __pyx_t_1;
    } else {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_INCREF(__pyx_v_maxx);
    __pyx_t_4 = __pyx_v_maxx;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __pyx_t_3;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF_SET(__pyx_v_maxx, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "renpy/gl/gldraw.pyx":859
 *             minx = max(minx, min(xo, xo + tw))
 *             maxx = min(maxx, max(xo, xo + tw))
 *             miny = max(miny, min(yo, yo + th))             # <<<<<<<<<<<<<<
 *             maxy = min(maxy, max(yo, yo + th))
 * 
 */
    __pyx_t_1 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_v_th); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_13 = __pyx_v_yo;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_t_4, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_1 = __pyx_t_3;
    } else {
      __pyx_t_5 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_v_miny);
    __pyx_t_1 = __pyx_v_miny;
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5 = __pyx_t_3;
    } else {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_5 = __pyx_t_1;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF_SET(__pyx_v_miny, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "renpy/gl/gldraw.pyx":860
 *             maxx = min(maxx, max(xo, xo + tw))
 *             miny = max(miny, min(yo, yo + th))
 *             maxy = min(maxy, max(yo, yo + th))             # <<<<<<<<<<<<<<
 * 
 *             clip = (minx, miny, maxx, maxy)
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_v_th); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_13 = __pyx_v_yo;
    __pyx_t_1 = PyFloat_FromDouble(__pyx_t_13); 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_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
    } else {
      __pyx_t_4 = PyFloat_FromDouble(__pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_v_maxy);
    __pyx_t_3 = __pyx_v_maxy;
    __pyx_t_1 = PyObject_RichCompare(__pyx_t_5, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = __pyx_t_5;
    } else {
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = __pyx_t_3;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_maxy, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "renpy/gl/gldraw.pyx":862
 *             maxy = min(maxy, max(yo, yo + th))
 * 
 *             clip = (minx, miny, maxx, maxy)             # <<<<<<<<<<<<<<
 * 
 *         alpha = alpha * rend.alpha
 */
    __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_minx);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_minx);
    __Pyx_GIVEREF(__pyx_v_minx);
    __Pyx_INCREF(__pyx_v_miny);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_miny);
    __Pyx_GIVEREF(__pyx_v_miny);
    __Pyx_INCREF(__pyx_v_maxx);
    PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_maxx);
    __Pyx_GIVEREF(__pyx_v_maxx);
    __Pyx_INCREF(__pyx_v_maxy);
    PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_v_maxy);
    __Pyx_GIVEREF(__pyx_v_maxy);
    __Pyx_DECREF_SET(__pyx_v_clip, ((PyObject*)__pyx_t_5));
    __pyx_t_5 = 0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "renpy/gl/gldraw.pyx":864
 *             clip = (minx, miny, maxx, maxy)
 * 
 *         alpha = alpha * rend.alpha             # <<<<<<<<<<<<<<
 *         over = over * rend.over
 * 
 */
  __pyx_v_alpha = (__pyx_v_alpha * __pyx_v_rend->alpha);

  /* "renpy/gl/gldraw.pyx":865
 * 
 *         alpha = alpha * rend.alpha
 *         over = over * rend.over             # <<<<<<<<<<<<<<
 * 
 *         # If our alpha has hit 0, don't do anything.
 */
  __pyx_v_over = (__pyx_v_over * __pyx_v_rend->over);

  /* "renpy/gl/gldraw.pyx":868
 * 
 *         # If our alpha has hit 0, don't do anything.
 *         if alpha <= 0.003: # (1 / 256)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_11 = ((__pyx_v_alpha <= 0.003) != 0);
  if (__pyx_t_11) {

    /* "renpy/gl/gldraw.pyx":869
 *         # If our alpha has hit 0, don't do anything.
 *         if alpha <= 0.003: # (1 / 256)
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "renpy/gl/gldraw.pyx":871
 *             return 0
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:             # <<<<<<<<<<<<<<
 *             child_reverse = rend.reverse * reverse
 *         else:
 */
  __pyx_t_11 = (((PyObject *)__pyx_v_rend->reverse) != Py_None);
  if ((__pyx_t_11 != 0)) {
    __pyx_t_9 = (((PyObject *)__pyx_v_rend->reverse) != __pyx_v_5renpy_2gl_6gldraw_IDENTITY);
    __pyx_t_8 = (__pyx_t_9 != 0);
  } else {
    __pyx_t_8 = (__pyx_t_11 != 0);
  }
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":872
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:
 *             child_reverse = rend.reverse * reverse             # <<<<<<<<<<<<<<
 *         else:
 *             child_reverse = reverse
 */
    __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_v_rend->reverse), ((PyObject *)__pyx_v_reverse)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_child_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_5);
    __pyx_t_5 = 0;
    goto __pyx_L18;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":874
 *             child_reverse = rend.reverse * reverse
 *         else:
 *             child_reverse = reverse             # <<<<<<<<<<<<<<
 * 
 *         for child, cxo, cyo, focus, main in rend.visible_children:
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_reverse));
    __pyx_v_child_reverse = __pyx_v_reverse;
  }
  __pyx_L18:;

  /* "renpy/gl/gldraw.pyx":876
 *             child_reverse = reverse
 * 
 *         for child, cxo, cyo, focus, main in rend.visible_children:             # <<<<<<<<<<<<<<
 *             tcxo = reverse.xdx * cxo + reverse.xdy * cyo
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo
 */
  if (unlikely(((PyObject *)__pyx_v_rend->visible_children) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_t_5 = ((PyObject *)__pyx_v_rend->visible_children); __Pyx_INCREF(__pyx_t_5); __pyx_t_14 = 0;
  for (;;) {
    if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_5)) break;
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_4); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #else
    __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    #endif
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 5)) {
        if (size > 5) __Pyx_RaiseTooManyValuesError(5);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_15 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_15);
      #else
      Py_ssize_t i;
      PyObject** temps[5] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_2,&__pyx_t_15};
      for (i=0; i < 5; i++) {
        PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else
    {
      Py_ssize_t index = -1;
      PyObject** temps[5] = {&__pyx_t_3,&__pyx_t_1,&__pyx_t_6,&__pyx_t_2,&__pyx_t_15};
      __pyx_t_16 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_16);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_12 = Py_TYPE(__pyx_t_16)->tp_iternext;
      for (index=0; index < 5; index++) {
        PyObject* item = __pyx_t_12(__pyx_t_16); if (unlikely(!item)) goto __pyx_L21_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_16), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_12 = NULL;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      goto __pyx_L22_unpacking_done;
      __pyx_L21_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
      __pyx_t_12 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L22_unpacking_done:;
    }
    __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_child, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_v_cxo = __pyx_t_13;
    __pyx_v_cyo = __pyx_t_10;
    __Pyx_XDECREF_SET(__pyx_v_focus, __pyx_t_2);
    __pyx_t_2 = 0;
    __Pyx_XDECREF_SET(__pyx_v_main, __pyx_t_15);
    __pyx_t_15 = 0;

    /* "renpy/gl/gldraw.pyx":877
 * 
 *         for child, cxo, cyo, focus, main in rend.visible_children:
 *             tcxo = reverse.xdx * cxo + reverse.xdy * cyo             # <<<<<<<<<<<<<<
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo
 * 
 */
    __pyx_v_tcxo = ((__pyx_v_reverse->xdx * __pyx_v_cxo) + (__pyx_v_reverse->xdy * __pyx_v_cyo));

    /* "renpy/gl/gldraw.pyx":878
 *         for child, cxo, cyo, focus, main in rend.visible_children:
 *             tcxo = reverse.xdx * cxo + reverse.xdy * cyo
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo             # <<<<<<<<<<<<<<
 * 
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, over, child_reverse)
 */
    __pyx_v_tcyo = ((__pyx_v_reverse->ydx * __pyx_v_cxo) + (__pyx_v_reverse->ydy * __pyx_v_cyo));

    /* "renpy/gl/gldraw.pyx":880
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo
 * 
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, over, child_reverse)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_child, __pyx_v_clip, (__pyx_v_xo + __pyx_v_tcxo), (__pyx_v_yo + __pyx_v_tcyo), __pyx_v_alpha, __pyx_v_over, __pyx_v_child_reverse, 0);
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":882
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, over, child_reverse)
 * 
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     def render_to_texture(self_, what, alpha):
 */
  __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_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_XDECREF(__pyx_t_16);
  __Pyx_WriteUnraisable("renpy.gl.gldraw.GLDraw.draw_transformed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rend);
  __Pyx_XDECREF((PyObject *)__pyx_v_child_reverse);
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XDECREF(__pyx_v_p);
  __Pyx_XDECREF(__pyx_v_pc);
  __Pyx_XDECREF(__pyx_v_minx);
  __Pyx_XDECREF(__pyx_v_miny);
  __Pyx_XDECREF(__pyx_v_maxx);
  __Pyx_XDECREF(__pyx_v_maxy);
  __Pyx_XDECREF(__pyx_v_tw);
  __Pyx_XDECREF(__pyx_v_th);
  __Pyx_XDECREF(__pyx_v_child);
  __Pyx_XDECREF(__pyx_v_focus);
  __Pyx_XDECREF(__pyx_v_main);
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XDECREF((PyObject *)__pyx_v_reverse);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  PyObject *__pyx_v_clip = 0;
  double __pyx_v_xo;
  double __pyx_v_yo;
  double __pyx_v_alpha;
  double __pyx_v_over;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_transformed (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__clip,&__pyx_n_s__xo,&__pyx_n_s__yo,&__pyx_n_s__alpha,&__pyx_n_s__over,&__pyx_n_s__reverse,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__clip)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yo)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__over)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reverse)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_transformed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_what = values[0];
    __pyx_v_clip = ((PyObject*)values[1]);
    __pyx_v_xo = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_xo == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_yo = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_yo == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_over = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_over == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)values[6]);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_transformed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_clip), (&PyTuple_Type), 1, "clip", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reverse), __pyx_ptype_5renpy_7display_6render_Matrix2D, 1, "reverse", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_transformed(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse);
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_28draw_transformed(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_clip, double __pyx_v_xo, double __pyx_v_yo, double __pyx_v_alpha, double __pyx_v_over, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse) {
  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("draw_transformed", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_what, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_over, __pyx_v_reverse, 1)); 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_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.gl.gldraw.GLDraw.draw_transformed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31render_to_texture(PyObject *__pyx_v_self_, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31render_to_texture(PyObject *__pyx_v_self_, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  PyObject *__pyx_v_alpha = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render_to_texture (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__alpha,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_to_texture", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render_to_texture") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __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_what = values[0];
    __pyx_v_alpha = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render_to_texture", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_30render_to_texture(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self_), __pyx_v_what, __pyx_v_alpha);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func = {__Pyx_NAMESTR("draw_func"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_func (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__w,&__pyx_n_s__h,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_func") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_draw_func(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":890
 *         forward = reverse = IDENTITY
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_cur_scope;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_outer_scope;
  PyObject *__pyx_v_clip = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_func", 0);
  __pyx_outer_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "renpy/gl/gldraw.pyx":892
 *         def draw_func(x, y, w, h):
 * 
 *             self.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             if alpha:
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_n_s__clip_mode_rtt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 892; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __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 = 892; __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_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":894
 *             self.clip_mode_rtt(x, y, w, h)
 * 
 *             if alpha:             # <<<<<<<<<<<<<<
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)
 *             else:
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_alpha)) { __Pyx_RaiseClosureNameError("alpha"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_alpha); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "renpy/gl/gldraw.pyx":895
 * 
 *             if alpha:
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)             # <<<<<<<<<<<<<<
 *             else:
 *                 glClearColor(0.0, 0.0, 0.0, 1.0)
 */
    glClearColor(0.0, 0.0, 0.0, 0.0);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "renpy/gl/gldraw.pyx":897
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)
 *             else:
 *                 glClearColor(0.0, 0.0, 0.0, 1.0)             # <<<<<<<<<<<<<<
 * 
 *             glClear(GL_COLOR_BUFFER_BIT)
 */
    glClearColor(0.0, 0.0, 0.0, 1.0);
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":899
 *                 glClearColor(0.0, 0.0, 0.0, 1.0)
 * 
 *             glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *             self.default_clip = (0, 0, what.width, what.height)
 */
  glClear(GL_COLOR_BUFFER_BIT);

  /* "renpy/gl/gldraw.pyx":901
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             self.default_clip = (0, 0, what.width, what.height)             # <<<<<<<<<<<<<<
 *             clip = self.default_clip
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_what)) { __Pyx_RaiseClosureNameError("what"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_self->default_clip);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->default_clip));
  __pyx_cur_scope->__pyx_v_self->default_clip = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":902
 * 
 *             self.default_clip = (0, 0, what.width, what.height)
 *             clip = self.default_clip             # <<<<<<<<<<<<<<
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)
 */
  __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->default_clip);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_clip = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":904
 *             clip = self.default_clip
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(what, render.Render):
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(!__pyx_cur_scope->__pyx_v_reverse)) { __Pyx_RaiseClosureNameError("reverse"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (!(likely(((__pyx_cur_scope->__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_reverse, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_reverse;
  __Pyx_INCREF(__pyx_t_2);
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_cur_scope->__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_cur_scope->__pyx_v_self, __pyx_t_1, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_2), 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":884
 *         return 0
 * 
 *     def render_to_texture(self_, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         cdef GLDraw self = self_
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_30render_to_texture(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self_, PyObject *__pyx_v_what, PyObject *__pyx_v_alpha) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_cur_scope;
  CYTHON_UNUSED PyObject *__pyx_v_forward = NULL;
  PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  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("render_to_texture", 0);
  __pyx_cur_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_what = __pyx_v_what;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);
  __pyx_cur_scope->__pyx_v_alpha = __pyx_v_alpha;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alpha);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alpha);

  /* "renpy/gl/gldraw.pyx":886
 *     def render_to_texture(self_, what, alpha):
 * 
 *         cdef GLDraw self = self_             # <<<<<<<<<<<<<<
 * 
 *         forward = reverse = IDENTITY
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self_));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self_));
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self_;

  /* "renpy/gl/gldraw.pyx":888
 *         cdef GLDraw self = self_
 * 
 *         forward = reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         def draw_func(x, y, w, h):
 */
  __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_v_forward = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __Pyx_GIVEREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_cur_scope->__pyx_v_reverse = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;

  /* "renpy/gl/gldraw.pyx":890
 *         forward = reverse = IDENTITY
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_17render_to_texture_1draw_func, 0, __pyx_n_s_74, ((PyObject*)__pyx_cur_scope), __pyx_n_s_35, ((PyObject *)__pyx_k_codeobj_73)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_draw_func = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":906
 *             self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_1, ((PyObject*)__pyx_ptype_5renpy_7display_6render_Render)); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":907
 * 
 *         if isinstance(what, render.Render):
 *             what.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         self.upscale_factor = 1.0
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __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 = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":909
 *             what.is_opaque()
 * 
 *         self.upscale_factor = 1.0             # <<<<<<<<<<<<<<
 * 
 *         rv = gltexture.texture_grid_from_drawing(what.width, what.height, draw_func, self.rtt, self.environ)
 */
  __pyx_cur_scope->__pyx_v_self->upscale_factor = 1.0;

  /* "renpy/gl/gldraw.pyx":911
 *         self.upscale_factor = 1.0
 * 
 *         rv = gltexture.texture_grid_from_drawing(what.width, what.height, draw_func, self.rtt, self.environ)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_75); 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_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_draw_func);
  PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_draw_func);
  __Pyx_GIVEREF(__pyx_v_draw_func);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self->rtt);
  PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_cur_scope->__pyx_v_self->rtt);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self->rtt);
  __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
  PyTuple_SET_ITEM(__pyx_t_6, 4, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
  __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __pyx_v_rv = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":913
 *         rv = gltexture.texture_grid_from_drawing(what.width, what.height, draw_func, self.rtt, self.environ)
 * 
 *         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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.render_to_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_forward);
  __Pyx_XDECREF(__pyx_v_draw_func);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_32is_pixel_opaque[] = "\n        Returns true if the pixel is not 100% transparent.\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("is_pixel_opaque (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__x,&__pyx_n_s__y,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "is_pixel_opaque") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __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_what = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 916; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.is_pixel_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_32is_pixel_opaque(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_x, __pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":916
 * 
 * 
 *     def is_pixel_opaque(self, what, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the pixel is not 100% transparent.
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_32is_pixel_opaque(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  CYTHON_UNUSED PyObject *__pyx_v_forward = NULL;
  PyObject *__pyx_v_reverse = NULL;
  PyObject *__pyx_v_clip = NULL;
  unsigned char __pyx_v_pixel[4];
  unsigned char __pyx_v_a;
  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;
  __Pyx_RefNannySetupContext("is_pixel_opaque", 0);
  __Pyx_INCREF(__pyx_v_what);

  /* "renpy/gl/gldraw.pyx":921
 *         """
 * 
 *         if x < 0 or y < 0 or x >= what.width or y >= what.height:             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_x, __pyx_int_0, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __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); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __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); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __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 = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __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); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __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 = 921; __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/gl/gldraw.pyx":922
 * 
 *         if x < 0 or y < 0 or x >= what.width or y >= what.height:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         if self.always_opaque:
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_0);
    __pyx_r = __pyx_int_0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":924
 *             return 0
 * 
 *         if self.always_opaque:             # <<<<<<<<<<<<<<
 *             return 255
 * 
 */
  __pyx_t_3 = (__pyx_v_self->always_opaque != 0);
  if (__pyx_t_3) {

    /* "renpy/gl/gldraw.pyx":925
 * 
 *         if self.always_opaque:
 *             return 255             # <<<<<<<<<<<<<<
 * 
 *         what = what.subsurface((x, y, 1, 1))
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_int_255);
    __pyx_r = __pyx_int_255;
    goto __pyx_L0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "renpy/gl/gldraw.pyx":927
 *             return 255
 * 
 *         what = what.subsurface((x, y, 1, 1))             # <<<<<<<<<<<<<<
 * 
 *         forward = reverse = IDENTITY
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_what, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":929
 *         what = what.subsurface((x, y, 1, 1))
 * 
 *         forward = reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         self.environ.viewport(0, 0, 1, 1)
 */
  __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_v_forward = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __pyx_v_reverse = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;

  /* "renpy/gl/gldraw.pyx":931
 *         forward = reverse = IDENTITY
 * 
 *         self.environ.viewport(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 *         glClearColor(0.0, 0.0, 0.0, 0.0)
 * 
 */
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->viewport(__pyx_v_self->environ, 0, 0, 1, 1);

  /* "renpy/gl/gldraw.pyx":932
 * 
 *         self.environ.viewport(0, 0, 1, 1)
 *         glClearColor(0.0, 0.0, 0.0, 0.0)             # <<<<<<<<<<<<<<
 * 
 *         glClear(GL_COLOR_BUFFER_BIT)
 */
  glClearColor(0.0, 0.0, 0.0, 0.0);

  /* "renpy/gl/gldraw.pyx":934
 *         glClearColor(0.0, 0.0, 0.0, 0.0)
 * 
 *         glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *         self.environ.ortho(0, 1, 0, 1, -1, 1)
 */
  glClear(GL_COLOR_BUFFER_BIT);

  /* "renpy/gl/gldraw.pyx":936
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 *         self.environ.ortho(0, 1, 0, 1, -1, 1)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_rtt(0, 0, 1, 1)
 */
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->ortho(__pyx_v_self->environ, 0.0, 1.0, 0.0, 1.0, -1.0, 1.0);

  /* "renpy/gl/gldraw.pyx":938
 *         self.environ.ortho(0, 1, 0, 1, -1, 1)
 * 
 *         self.clip_mode_rtt(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *         clip = (0, 0, 1, 1)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__clip_mode_rtt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "renpy/gl/gldraw.pyx":940
 *         self.clip_mode_rtt(0, 0, 1, 1)
 * 
 *         clip = (0, 0, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *         self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)
 */
  __Pyx_INCREF(((PyObject *)__pyx_k_tuple_77));
  __pyx_v_clip = __pyx_k_tuple_77;

  /* "renpy/gl/gldraw.pyx":942
 *         clip = (0, 0, 1, 1)
 * 
 *         self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         cdef unsigned char pixel[4]
 */
  if (!(likely(((__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_reverse, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_v_what, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse), 0);

  /* "renpy/gl/gldraw.pyx":946
 *         cdef unsigned char pixel[4]
 * 
 *         glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel)             # <<<<<<<<<<<<<<
 * 
 *         a = pixel[3]
 */
  glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_pixel);

  /* "renpy/gl/gldraw.pyx":948
 *         glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel)
 * 
 *         a = pixel[3]             # <<<<<<<<<<<<<<
 * 
 *         what.kill()
 */
  __pyx_v_a = (__pyx_v_pixel[3]);

  /* "renpy/gl/gldraw.pyx":950
 *         a = pixel[3]
 * 
 *         what.kill()             # <<<<<<<<<<<<<<
 * 
 *         return a
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_what, __pyx_n_s__kill); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":952
 *         what.kill()
 * 
 *         return a             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = PyInt_FromLong(__pyx_v_a); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __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_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.is_pixel_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_forward);
  __Pyx_XDECREF(__pyx_v_reverse);
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XDECREF(__pyx_v_what);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_35get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_6GLDraw_34get_half[] = "\n        Gets a texture grid that's half the size of what..\n        ";
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_35get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_half (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_34get_half(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_what));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func = {__Pyx_NAMESTR("draw_func"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_func (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__w,&__pyx_n_s__h,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "draw_func") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __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_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_half.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8get_half_draw_func(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":972
 *         height = max(what.height / 2, 1)
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_w, PyObject *__pyx_v_h) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *__pyx_cur_scope;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *__pyx_outer_scope;
  PyObject *__pyx_v_clip = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_func", 0);
  __pyx_outer_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "renpy/gl/gldraw.pyx":974
 *         def draw_func(x, y, w, h):
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)             # <<<<<<<<<<<<<<
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 */
  glClearColor(0.0, 0.0, 0.0, 1.0);

  /* "renpy/gl/gldraw.pyx":975
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 *             glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *             draw.clip_mode_rtt(x, y, w, h)
 */
  glClear(GL_COLOR_BUFFER_BIT);

  /* "renpy/gl/gldraw.pyx":977
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             draw.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             clip = (0, 0, width, height)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_draw)) { __Pyx_RaiseClosureNameError("draw"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_v_draw), __pyx_n_s__clip_mode_rtt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __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 = 977; __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_t_3); __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":979
 *             draw.clip_mode_rtt(x, y, w, h)
 * 
 *             clip = (0, 0, width, height)             # <<<<<<<<<<<<<<
 * 
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_width)) { __Pyx_RaiseClosureNameError("width"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (unlikely(!__pyx_cur_scope->__pyx_v_height)) { __Pyx_RaiseClosureNameError("height"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_cur_scope->__pyx_v_width);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_cur_scope->__pyx_v_height);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
  __pyx_v_clip = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":981
 *             clip = (0, 0, width, height)
 * 
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(what, render.Render):
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_what)) { __Pyx_RaiseClosureNameError("what"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_3);
  if (unlikely(!__pyx_cur_scope->__pyx_v_reverse)) { __Pyx_RaiseClosureNameError("reverse"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  if (!(likely(((__pyx_cur_scope->__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_cur_scope->__pyx_v_reverse, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 981; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_reverse;
  __Pyx_INCREF(__pyx_t_2);
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_cur_scope->__pyx_v_draw->__pyx_vtab)->draw_transformed(__pyx_cur_scope->__pyx_v_draw, __pyx_t_3, __pyx_v_clip, 0.0, 0.0, 1.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_2), 0);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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_3);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_half.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_clip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":955
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_34get_half(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_what) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *__pyx_cur_scope;
  CYTHON_UNUSED PyObject *__pyx_v_forward = NULL;
  PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  long __pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_half", 0);
  __pyx_cur_scope = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *)__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half(__pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_what = __pyx_v_what;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);

  /* "renpy/gl/gldraw.pyx":961
 *         # Used to work around a bug in cython where self was not getting
 *         # the right type when being assigned to the closure.
 *         cdef GLDraw draw = self             # <<<<<<<<<<<<<<
 * 
 *         if what.half_cache:
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_cur_scope->__pyx_v_draw = __pyx_v_self;

  /* "renpy/gl/gldraw.pyx":963
 *         cdef GLDraw draw = self
 * 
 *         if what.half_cache:             # <<<<<<<<<<<<<<
 *             return what.half_cache
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__half_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 963; __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 = 963; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/gl/gldraw.pyx":964
 * 
 *         if what.half_cache:
 *             return what.half_cache             # <<<<<<<<<<<<<<
 * 
 *         reverse = renpy.display.render.Matrix2D(0.5, 0, 0, .5)
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__half_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 964; __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_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":966
 *             return what.half_cache
 * 
 *         reverse = renpy.display.render.Matrix2D(0.5, 0, 0, .5)             # <<<<<<<<<<<<<<
 *         forward = renpy.display.render.Matrix2D(2.0, 0, 0, 2.0)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __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_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__Matrix2D); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyFloat_FromDouble(.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __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_5)); __pyx_t_5 = 0;
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_cur_scope->__pyx_v_reverse = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":967
 * 
 *         reverse = renpy.display.render.Matrix2D(0.5, 0, 0, .5)
 *         forward = renpy.display.render.Matrix2D(2.0, 0, 0, 2.0)             # <<<<<<<<<<<<<<
 * 
 *         width = max(what.width / 2, 1)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__render); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__Matrix2D); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __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 = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_forward = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":969
 *         forward = renpy.display.render.Matrix2D(2.0, 0, 0, 2.0)
 * 
 *         width = max(what.width / 2, 1)             # <<<<<<<<<<<<<<
 *         height = max(what.height / 2, 1)
 * 
 */
  __pyx_t_6 = 1;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = PyInt_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {
    __pyx_t_4 = PyInt_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_width = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":970
 * 
 *         width = max(what.width / 2, 1)
 *         height = max(what.height / 2, 1)             # <<<<<<<<<<<<<<
 * 
 *         def draw_func(x, y, w, h):
 */
  __pyx_t_6 = 1;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__height); 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_PyNumber_Divide(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_t_6); 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_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_2) {
    __pyx_t_5 = PyInt_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __pyx_t_1;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_height = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":972
 *         height = max(what.height / 2, 1)
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 */
  __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_6GLDraw_8get_half_1draw_func, 0, __pyx_n_s_80, ((PyObject*)__pyx_cur_scope), __pyx_n_s_35, ((PyObject *)__pyx_k_codeobj_79)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_draw_func = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":983
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_what;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_3, ((PyObject*)__pyx_ptype_5renpy_7display_6render_Render)); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = (__pyx_t_2 != 0);
  if (__pyx_t_7) {

    /* "renpy/gl/gldraw.pyx":984
 * 
 *         if isinstance(what, render.Render):
 *             what.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "renpy/gl/gldraw.pyx":986
 *             what.is_opaque()
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)             # <<<<<<<<<<<<<<
 * 
 *         what.half_cache = rv
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_75); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __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(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_width);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_height);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
  __Pyx_INCREF(__pyx_v_draw_func);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_draw_func);
  __Pyx_GIVEREF(__pyx_v_draw_func);
  __Pyx_INCREF(__pyx_v_self->rtt);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_self->rtt);
  __Pyx_GIVEREF(__pyx_v_self->rtt);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->environ));
  PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_v_self->environ));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->environ));
  __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_v_rv = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":988
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)
 * 
 *         what.half_cache = rv             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__half_cache, __pyx_v_rv) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":990
 *         what.half_cache = rv
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def update_mouse(self):
 */
  __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_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_half", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_forward);
  __Pyx_XDECREF(__pyx_v_draw_func);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_37update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_37update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_mouse (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_36update_mouse(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":992
 *         return rv
 * 
 *     def update_mouse(self):             # <<<<<<<<<<<<<<
 *         # The draw routine updates the mouse. There's no need to
 *         # redraw it event-by-event.
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_36update_mouse(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_mouse", 0);

  /* "renpy/gl/gldraw.pyx":996
 *         # redraw it event-by-event.
 * 
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def translate_mouse(self, x, y):
 */
  __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;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_39translate_mouse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_39translate_mouse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("translate_mouse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("translate_mouse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate_mouse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __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("translate_mouse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.translate_mouse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_38translate_mouse(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":998
 *         return
 * 
 *     def translate_mouse(self, x, y):             # <<<<<<<<<<<<<<
 * 
 *         # Screen sizes.
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_38translate_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_pw = NULL;
  PyObject *__pyx_v_ph = NULL;
  PyObject *__pyx_v_vw = NULL;
  PyObject *__pyx_v_vh = NULL;
  PyObject *__pyx_v_vx = NULL;
  PyObject *__pyx_v_vy = NULL;
  PyObject *__pyx_v_vbw = NULL;
  PyObject *__pyx_v_vbh = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  long __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("translate_mouse", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "renpy/gl/gldraw.pyx":1001
 * 
 *         # Screen sizes.
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->physical_size);
  __Pyx_INCREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_pw = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_ph = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1002
 *         # Screen sizes.
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size             # <<<<<<<<<<<<<<
 *         vx, vy, vbw, vbh = self.virtual_box
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->virtual_size);
  __Pyx_INCREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_vw = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_vh = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1003
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box             # <<<<<<<<<<<<<<
 * 
 *         # Translate to fractional screen.
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->virtual_box);
  __Pyx_INCREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_6);
    #else
    Py_ssize_t i;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_6};
    for (i=0; i < 4; i++) {
      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(item);
      *(temps[i]) = item;
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_7)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_5(__pyx_t_7); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_7), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1003; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_vx = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vy = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_vbw = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_vbh = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1006
 * 
 *         # Translate to fractional screen.
 *         x = 1.0 * x / pw             # <<<<<<<<<<<<<<
 *         y = 1.0 * y / ph
 * 
 */
  __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_v_x); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_pw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1007
 *         # Translate to fractional screen.
 *         x = 1.0 * x / pw
 *         y = 1.0 * y / ph             # <<<<<<<<<<<<<<
 * 
 *         # Translate to virtual size.
 */
  __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_v_y); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_ph); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1010
 * 
 *         # Translate to virtual size.
 *         x = vx + vbw * x             # <<<<<<<<<<<<<<
 *         y = vy + vbh * y
 * 
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_vbw, __pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = PyNumber_Add(__pyx_v_vx, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1011
 *         # Translate to virtual size.
 *         x = vx + vbw * x
 *         y = vy + vbh * y             # <<<<<<<<<<<<<<
 * 
 *         x = int(x)
 */
  __pyx_t_6 = PyNumber_Multiply(__pyx_v_vbh, __pyx_v_y); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyNumber_Add(__pyx_v_vy, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1013
 *         y = vy + vbh * y
 * 
 *         x = int(x)             # <<<<<<<<<<<<<<
 *         y = int(y)
 * 
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1014
 * 
 *         x = int(x)
 *         y = int(y)             # <<<<<<<<<<<<<<
 * 
 *         x = max(0, x)
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1016
 *         y = int(y)
 * 
 *         x = max(0, x)             # <<<<<<<<<<<<<<
 *         x = min(vw, x)
 *         y = max(0, y)
 */
  __Pyx_INCREF(__pyx_v_x);
  __pyx_t_1 = __pyx_v_x;
  __pyx_t_8 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_9) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = __pyx_t_1;
  } else {
    __pyx_t_3 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __pyx_t_3;
    __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_6;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1017
 * 
 *         x = max(0, x)
 *         x = min(vw, x)             # <<<<<<<<<<<<<<
 *         y = max(0, y)
 *         y = min(vh, y)
 */
  __Pyx_INCREF(__pyx_v_x);
  __pyx_t_1 = __pyx_v_x;
  __Pyx_INCREF(__pyx_v_vw);
  __pyx_t_6 = __pyx_v_vw;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_9) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_3 = __pyx_t_6;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1018
 *         x = max(0, x)
 *         x = min(vw, x)
 *         y = max(0, y)             # <<<<<<<<<<<<<<
 *         y = min(vh, y)
 * 
 */
  __Pyx_INCREF(__pyx_v_y);
  __pyx_t_1 = __pyx_v_y;
  __pyx_t_8 = 0;
  __pyx_t_6 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_9) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_4 = PyInt_FromLong(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_3;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1019
 *         x = min(vw, x)
 *         y = max(0, y)
 *         y = min(vh, y)             # <<<<<<<<<<<<<<
 * 
 *         return x, y
 */
  __Pyx_INCREF(__pyx_v_y);
  __pyx_t_1 = __pyx_v_y;
  __Pyx_INCREF(__pyx_v_vh);
  __pyx_t_3 = __pyx_v_vh;
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_9) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_4 = __pyx_t_1;
  } else {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = __pyx_t_3;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __pyx_t_4;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1021
 *         y = min(vh, y)
 * 
 *         return x, y             # <<<<<<<<<<<<<<
 * 
 *     def untranslate_mouse(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1021; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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_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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.translate_mouse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pw);
  __Pyx_XDECREF(__pyx_v_ph);
  __Pyx_XDECREF(__pyx_v_vw);
  __Pyx_XDECREF(__pyx_v_vh);
  __Pyx_XDECREF(__pyx_v_vx);
  __Pyx_XDECREF(__pyx_v_vy);
  __Pyx_XDECREF(__pyx_v_vbw);
  __Pyx_XDECREF(__pyx_v_vbh);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_41untranslate_mouse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_41untranslate_mouse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("untranslate_mouse (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("untranslate_mouse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "untranslate_mouse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __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("untranslate_mouse", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.untranslate_mouse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_40untranslate_mouse(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1023
 *         return x, y
 * 
 *     def untranslate_mouse(self, x, y):             # <<<<<<<<<<<<<<
 * 
 *         # Screen sizes.
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_40untranslate_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_v_pw = NULL;
  PyObject *__pyx_v_ph = NULL;
  PyObject *__pyx_v_vx = NULL;
  PyObject *__pyx_v_vy = NULL;
  PyObject *__pyx_v_vbw = NULL;
  PyObject *__pyx_v_vbh = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("untranslate_mouse", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "renpy/gl/gldraw.pyx":1026
 * 
 *         # Screen sizes.
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         vx, vy, vbw, vbh = self.virtual_box
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->physical_size);
  __Pyx_INCREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_pw = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_ph = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1027
 *         # Screen sizes.
 *         pw, ph = self.physical_size
 *         vx, vy, vbw, vbh = self.virtual_box             # <<<<<<<<<<<<<<
 * 
 *         # Translate from virtual size.
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_self->virtual_box);
  __Pyx_INCREF(__pyx_t_1);
  if (likely(PyTuple_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_6);
    #else
    Py_ssize_t i;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_6};
    for (i=0; i < 4; i++) {
      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(item);
      *(temps[i]) = item;
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_3,&__pyx_t_2,&__pyx_t_4,&__pyx_t_6};
    __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_7)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_5(__pyx_t_7); if (unlikely(!item)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_7), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_vx = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_vy = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vbw = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_vbh = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1030
 * 
 *         # Translate from virtual size.
 *         x = ( x - vx ) / vbw             # <<<<<<<<<<<<<<
 *         y = ( y - vy ) / vbh
 * 
 */
  __pyx_t_1 = PyNumber_Subtract(__pyx_v_x, __pyx_v_vx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_vbw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1030; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1031
 *         # Translate from virtual size.
 *         x = ( x - vx ) / vbw
 *         y = ( y - vy ) / vbh             # <<<<<<<<<<<<<<
 * 
 *         # Translate from fractional screen.
 */
  __pyx_t_6 = PyNumber_Subtract(__pyx_v_y, __pyx_v_vy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_v_vbh); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1034
 * 
 *         # Translate from fractional screen.
 *         x = x * pw             # <<<<<<<<<<<<<<
 *         y = y * ph
 * 
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_x, __pyx_v_pw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1035
 *         # Translate from fractional screen.
 *         x = x * pw
 *         y = y * ph             # <<<<<<<<<<<<<<
 * 
 *         x = int(x)
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_y, __pyx_v_ph); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1037
 *         y = y * ph
 * 
 *         x = int(x)             # <<<<<<<<<<<<<<
 *         y = int(y)
 * 
 */
  __pyx_t_1 = PyTuple_New(1); 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_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1038
 * 
 *         x = int(x)
 *         y = int(y)             # <<<<<<<<<<<<<<
 * 
 *         return x, y
 */
  __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1040
 *         y = int(y)
 * 
 *         return x, y             # <<<<<<<<<<<<<<
 * 
 *     def mouse_event(self, ev):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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_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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.untranslate_mouse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pw);
  __Pyx_XDECREF(__pyx_v_ph);
  __Pyx_XDECREF(__pyx_v_vx);
  __Pyx_XDECREF(__pyx_v_vy);
  __Pyx_XDECREF(__pyx_v_vbw);
  __Pyx_XDECREF(__pyx_v_vbh);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_43mouse_event(PyObject *__pyx_v_self, PyObject *__pyx_v_ev); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_43mouse_event(PyObject *__pyx_v_self, PyObject *__pyx_v_ev) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("mouse_event (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_42mouse_event(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_ev));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1042
 *         return x, y
 * 
 *     def mouse_event(self, ev):             # <<<<<<<<<<<<<<
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())
 *         return self.translate_mouse(x, y)
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_42mouse_event(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_ev) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mouse_event", 0);

  /* "renpy/gl/gldraw.pyx":1043
 * 
 *     def mouse_event(self, ev):
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())             # <<<<<<<<<<<<<<
 *         return self.translate_mouse(x, y)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__get_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __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 = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_ev, ((PyObject *)__pyx_n_s__pos), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_y = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1044
 *     def mouse_event(self, ev):
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())
 *         return self.translate_mouse(x, y)             # <<<<<<<<<<<<<<
 * 
 *     def get_mouse_pos(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate_mouse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __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 = 1044; __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_r = __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_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.mouse_event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_45get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_45get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_mouse_pos (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_44get_mouse_pos(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1046
 *         return self.translate_mouse(x, y)
 * 
 *     def get_mouse_pos(self):             # <<<<<<<<<<<<<<
 *         x, y = pygame.mouse.get_pos()
 *         return self.translate_mouse(x, y)
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_44get_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_mouse_pos", 0);

  /* "renpy/gl/gldraw.pyx":1047
 * 
 *     def get_mouse_pos(self):
 *         x, y = pygame.mouse.get_pos()             # <<<<<<<<<<<<<<
 *         return self.translate_mouse(x, y)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__get_pos); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __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 = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    #endif
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1048
 *     def get_mouse_pos(self):
 *         x, y = pygame.mouse.get_pos()
 *         return self.translate_mouse(x, y)             # <<<<<<<<<<<<<<
 * 
 *     def set_mouse_pos(self, x, y):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate_mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __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 = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __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 = 1048; __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_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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.get_mouse_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_47set_mouse_pos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_47set_mouse_pos(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_mouse_pos (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mouse_pos", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_mouse_pos") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __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("set_mouse_pos", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.set_mouse_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_46set_mouse_pos(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_x, __pyx_v_y);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1050
 *         return self.translate_mouse(x, y)
 * 
 *     def set_mouse_pos(self, x, y):             # <<<<<<<<<<<<<<
 *         x, y = self.untranslate_mouse(x, y)
 *         pygame.mouse.set_pos([x, y])
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_46set_mouse_pos(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *(*__pyx_t_5)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("set_mouse_pos", 0);
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "renpy/gl/gldraw.pyx":1051
 * 
 *     def set_mouse_pos(self, x, y):
 *         x, y = self.untranslate_mouse(x, y)             # <<<<<<<<<<<<<<
 *         pygame.mouse.set_pos([x, y])
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__untranslate_mouse); 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_t_2 = PyTuple_New(2); 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_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __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 = 1051; __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;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_2 = PySequence_ITEM(sequence, 0); 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_t_1 = PySequence_ITEM(sequence, 1); 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);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
    index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_5 = NULL;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_2);
  __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1052
 *     def set_mouse_pos(self, x, y):
 *         x, y = self.untranslate_mouse(x, y)
 *         pygame.mouse.set_pos([x, y])             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__mouse); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__set_pos); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyList_New(2); 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_INCREF(__pyx_v_x);
  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_2 = PyTuple_New(1); 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);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 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_AddTraceback("renpy.gl.gldraw.GLDraw.set_mouse_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_49draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_49draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("draw_mouse (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_48draw_mouse(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1056
 * 
 *     # Private.
 *     def draw_mouse(self):             # <<<<<<<<<<<<<<
 * 
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_48draw_mouse(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_v_hardware = NULL;
  PyObject *__pyx_v_mx = NULL;
  PyObject *__pyx_v_my = NULL;
  PyObject *__pyx_v_tex = NULL;
  PyObject *__pyx_v_x = NULL;
  PyObject *__pyx_v_y = NULL;
  PyObject *__pyx_v_pw = NULL;
  PyObject *__pyx_v_ph = NULL;
  PyObject *__pyx_v_pbx = NULL;
  PyObject *__pyx_v_pby = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_pbw = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_pbh = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *(*__pyx_t_7)(PyObject *);
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  double __pyx_t_12;
  double __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_mouse", 0);

  /* "renpy/gl/gldraw.pyx":1058
 *     def draw_mouse(self):
 * 
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()             # <<<<<<<<<<<<<<
 * 
 *         self.mouse_info = (mx, my, tex)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__game); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__interface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_mouse_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __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 = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyList_GET_ITEM(sequence, 3); 
    }
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_5);
    #else
    Py_ssize_t i;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
    for (i=0; i < 4; i++) {
      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(item);
      *(temps[i]) = item;
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else
  {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_5};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L3_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L4_unpacking_done;
    __pyx_L3_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L4_unpacking_done:;
  }
  __pyx_v_hardware = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_mx = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_my = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_tex = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1060
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()
 * 
 *         self.mouse_info = (mx, my, tex)             # <<<<<<<<<<<<<<
 * 
 *         if self.mouse_old_visible != hardware:
 */
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_mx);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mx);
  __Pyx_GIVEREF(__pyx_v_mx);
  __Pyx_INCREF(__pyx_v_my);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_my);
  __Pyx_GIVEREF(__pyx_v_my);
  __Pyx_INCREF(__pyx_v_tex);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_tex);
  __Pyx_GIVEREF(__pyx_v_tex);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(__pyx_v_self->mouse_info);
  __Pyx_DECREF(__pyx_v_self->mouse_info);
  __pyx_v_self->mouse_info = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1062
 *         self.mouse_info = (mx, my, tex)
 * 
 *         if self.mouse_old_visible != hardware:             # <<<<<<<<<<<<<<
 *             pygame.mouse.set_visible(hardware)
 *             self.mouse_old_visible = hardware
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_self->mouse_old_visible, __pyx_v_hardware, Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "renpy/gl/gldraw.pyx":1063
 * 
 *         if self.mouse_old_visible != hardware:
 *             pygame.mouse.set_visible(hardware)             # <<<<<<<<<<<<<<
 *             self.mouse_old_visible = hardware
 * 
 */
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__mouse); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__set_visible); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_hardware);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_hardware);
    __Pyx_GIVEREF(__pyx_v_hardware);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":1064
 *         if self.mouse_old_visible != hardware:
 *             pygame.mouse.set_visible(hardware)
 *             self.mouse_old_visible = hardware             # <<<<<<<<<<<<<<
 * 
 *         if not tex:
 */
    __Pyx_INCREF(__pyx_v_hardware);
    __Pyx_GIVEREF(__pyx_v_hardware);
    __Pyx_GOTREF(__pyx_v_self->mouse_old_visible);
    __Pyx_DECREF(__pyx_v_self->mouse_old_visible);
    __pyx_v_self->mouse_old_visible = __pyx_v_hardware;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "renpy/gl/gldraw.pyx":1066
 *             self.mouse_old_visible = hardware
 * 
 *         if not tex:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_tex); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = ((!__pyx_t_8) != 0);
  if (__pyx_t_9) {

    /* "renpy/gl/gldraw.pyx":1067
 * 
 *         if not tex:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         x, y = pygame.mouse.get_pos()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/gl/gldraw.pyx":1069
 *             return
 * 
 *         x, y = pygame.mouse.get_pos()             # <<<<<<<<<<<<<<
 * 
 *         x -= mx
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__pygame); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__mouse); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__get_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    #else
    __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __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_L7_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_L7_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 = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L8_unpacking_done;
    __pyx_L7_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L8_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_y = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1071
 *         x, y = pygame.mouse.get_pos()
 * 
 *         x -= mx             # <<<<<<<<<<<<<<
 *         y -= my
 * 
 */
  __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_v_x, __pyx_v_mx); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1072
 * 
 *         x -= mx
 *         y -= my             # <<<<<<<<<<<<<<
 * 
 *         pw, ph = self.physical_size
 */
  __pyx_t_5 = PyNumber_InPlaceSubtract(__pyx_v_y, __pyx_v_my); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF_SET(__pyx_v_y, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1074
 *         y -= my
 * 
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         pbx, pby, pbw, pbh = self.physical_box
 * 
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_self->physical_size);
  __Pyx_INCREF(__pyx_t_5);
  if (likely(PyTuple_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_4);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_3)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_1)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_4 = __pyx_t_7(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L9_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_3), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L10_unpacking_done:;
  }
  __pyx_v_pw = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_ph = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1075
 * 
 *         pw, ph = self.physical_size
 *         pbx, pby, pbw, pbh = self.physical_box             # <<<<<<<<<<<<<<
 * 
 *         self.environ.viewport(0, 0, pw, ph)
 */
  __pyx_t_5 = ((PyObject *)__pyx_v_self->physical_box);
  __Pyx_INCREF(__pyx_t_5);
  if (likely(PyTuple_CheckExact(__pyx_t_5))) {
    PyObject* sequence = __pyx_t_5;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_2);
    #else
    Py_ssize_t i;
    PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_1,&__pyx_t_3,&__pyx_t_2};
    for (i=0; i < 4; i++) {
      PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(item);
      *(temps[i]) = item;
    }
    #endif
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else if (1) {
    __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  } else
  {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_4,&__pyx_t_1,&__pyx_t_3,&__pyx_t_2};
    __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_7(__pyx_t_6); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_7 = NULL;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L12_unpacking_done;
    __pyx_L11_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L12_unpacking_done:;
  }
  __pyx_v_pbx = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_pby = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_pbw = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_pbh = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1077
 *         pbx, pby, pbw, pbh = self.physical_box
 * 
 *         self.environ.viewport(0, 0, pw, ph)             # <<<<<<<<<<<<<<
 *         self.environ.ortho(0, pw, ph, 0, -1.0, 1.0)
 * 
 */
  __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_v_pw); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_v_ph); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->viewport(__pyx_v_self->environ, 0, 0, __pyx_t_10, __pyx_t_11);

  /* "renpy/gl/gldraw.pyx":1078
 * 
 *         self.environ.viewport(0, 0, pw, ph)
 *         self.environ.ortho(0, pw, ph, 0, -1.0, 1.0)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_screen()
 */
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_pw); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_ph); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ *)__pyx_v_self->environ->__pyx_vtab)->ortho(__pyx_v_self->environ, 0.0, __pyx_t_12, __pyx_t_13, 0.0, -1.0, 1.0);

  /* "renpy/gl/gldraw.pyx":1080
 *         self.environ.ortho(0, pw, ph, 0, -1.0, 1.0)
 * 
 *         self.clip_mode_screen()             # <<<<<<<<<<<<<<
 *         self.set_clip((-pbx, -pby, pw, ph))
 * 
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__clip_mode_screen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1081
 * 
 *         self.clip_mode_screen()
 *         self.set_clip((-pbx, -pby, pw, ph))             # <<<<<<<<<<<<<<
 * 
 *         gltexture.blit(
 */
  __pyx_t_2 = PyNumber_Negative(__pyx_v_pbx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyNumber_Negative(__pyx_v_pby); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_pw);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_pw);
  __Pyx_GIVEREF(__pyx_v_pw);
  __Pyx_INCREF(__pyx_v_ph);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_ph);
  __Pyx_GIVEREF(__pyx_v_ph);
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = ((struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, ((PyObject*)__pyx_t_3), 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/gl/gldraw.pyx":1084
 * 
 *         gltexture.blit(
 *             tex,             # <<<<<<<<<<<<<<
 *             x,
 *             y,
 */
  if (!(likely(((__pyx_v_tex) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_tex, __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":1085
 *         gltexture.blit(
 *             tex,
 *             x,             # <<<<<<<<<<<<<<
 *             y,
 *             IDENTITY,
 */
  __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_x); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":1086
 *             tex,
 *             x,
 *             y,             # <<<<<<<<<<<<<<
 *             IDENTITY,
 *             1.0,
 */
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_y); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":1087
 *             x,
 *             y,
 *             IDENTITY,             # <<<<<<<<<<<<<<
 *             1.0,
 *             1.0,
 */
  if (!(likely(((__pyx_v_5renpy_2gl_6gldraw_IDENTITY) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_5renpy_2gl_6gldraw_IDENTITY, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __pyx_v_5renpy_2gl_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_t_5);

  /* "renpy/gl/gldraw.pyx":1090
 *             1.0,
 *             1.0,
 *             self.environ,             # <<<<<<<<<<<<<<
 *             False)
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_v_self->environ);
  __Pyx_INCREF(__pyx_t_3);

  /* "renpy/gl/gldraw.pyx":1091
 *             1.0,
 *             self.environ,
 *             False)             # <<<<<<<<<<<<<<
 * 
 *     def screenshot(self, surftree, fullscreen_video):
 */
  __pyx_t_2 = __pyx_f_5renpy_2gl_9gltexture_blit(((struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *)__pyx_v_tex), __pyx_t_13, __pyx_t_12, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_5), 1.0, 1.0, ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)__pyx_t_3), 0, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.draw_mouse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_hardware);
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XDECREF(__pyx_v_pw);
  __Pyx_XDECREF(__pyx_v_ph);
  __Pyx_XDECREF(__pyx_v_pbx);
  __Pyx_XDECREF(__pyx_v_pby);
  __Pyx_XDECREF(__pyx_v_pbw);
  __Pyx_XDECREF(__pyx_v_pbh);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_51screenshot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_51screenshot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surftree = 0;
  PyObject *__pyx_v_fullscreen_video = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("screenshot (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surftree,&__pyx_n_s__fullscreen_video,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__surftree)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fullscreen_video)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("screenshot", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "screenshot") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __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_surftree = values[0];
    __pyx_v_fullscreen_video = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("screenshot", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1093; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.screenshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_50screenshot(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surftree, __pyx_v_fullscreen_video);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1093
 *             False)
 * 
 *     def screenshot(self, surftree, fullscreen_video):             # <<<<<<<<<<<<<<
 *         cdef unsigned char *pixels
 *         cdef SDL_Surface *surf
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_50screenshot(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_surftree, PyObject *__pyx_v_fullscreen_video) {
  unsigned char *__pyx_v_pixels;
  struct SDL_Surface *__pyx_v_surf;
  unsigned char *__pyx_v_raw_pixels;
  unsigned char *__pyx_v_rpp;
  int __pyx_v_x;
  CYTHON_UNUSED int __pyx_v_y;
  int __pyx_v_pitch;
  PyObject *__pyx_v_full = NULL;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  long __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("screenshot", 0);

  /* "renpy/gl/gldraw.pyx":1102
 * 
 *         # A surface the size of the framebuffer.
 *         full = renpy.display.pgrender.surface_unscaled(self.physical_size, False)             # <<<<<<<<<<<<<<
 *         surf = PySurface_AsSurface(full)
 * 
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__surface_unscaled); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->physical_size));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->physical_size));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->physical_size));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __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 = 1102; __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_full = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/gl/gldraw.pyx":1103
 *         # A surface the size of the framebuffer.
 *         full = renpy.display.pgrender.surface_unscaled(self.physical_size, False)
 *         surf = PySurface_AsSurface(full)             # <<<<<<<<<<<<<<
 * 
 *         # Create an array that can hold densely-packed pixels.
 */
  __pyx_v_surf = PySurface_AsSurface(__pyx_v_full);

  /* "renpy/gl/gldraw.pyx":1106
 * 
 *         # Create an array that can hold densely-packed pixels.
 *         raw_pixels = <unsigned char *> malloc(surf.w * surf.h * 4)             # <<<<<<<<<<<<<<
 * 
 *         # Draw the last screen to the back buffer.
 */
  __pyx_v_raw_pixels = ((unsigned char *)malloc(((__pyx_v_surf->w * __pyx_v_surf->h) * 4)));

  /* "renpy/gl/gldraw.pyx":1109
 * 
 *         # Draw the last screen to the back buffer.
 *         if surftree is not None:             # <<<<<<<<<<<<<<
 *             self.draw_screen(surftree, fullscreen_video, flip=False)
 *             glFinish()
 */
  __pyx_t_4 = (__pyx_v_surftree != Py_None);
  __pyx_t_5 = (__pyx_t_4 != 0);
  if (__pyx_t_5) {

    /* "renpy/gl/gldraw.pyx":1110
 *         # Draw the last screen to the back buffer.
 *         if surftree is not None:
 *             self.draw_screen(surftree, fullscreen_video, flip=False)             # <<<<<<<<<<<<<<
 *             glFinish()
 * 
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__draw_screen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_surftree);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surftree);
    __Pyx_GIVEREF(__pyx_v_surftree);
    __Pyx_INCREF(__pyx_v_fullscreen_video);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_fullscreen_video);
    __Pyx_GIVEREF(__pyx_v_fullscreen_video);
    __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_6 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__flip), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "renpy/gl/gldraw.pyx":1111
 *         if surftree is not None:
 *             self.draw_screen(surftree, fullscreen_video, flip=False)
 *             glFinish()             # <<<<<<<<<<<<<<
 * 
 *         # Read the pixels.
 */
    glFinish();
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/gl/gldraw.pyx":1121
 *             GL_RGBA,
 *             GL_UNSIGNED_BYTE,
 *             raw_pixels)             # <<<<<<<<<<<<<<
 * 
 *         # Copy the pixels from raw_pixels to the surface.
 */
  glReadPixels(0, 0, __pyx_v_surf->w, __pyx_v_surf->h, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_raw_pixels);

  /* "renpy/gl/gldraw.pyx":1124
 * 
 *         # Copy the pixels from raw_pixels to the surface.
 *         pixels = <unsigned char *> surf.pixels             # <<<<<<<<<<<<<<
 *         pitch = surf.pitch
 *         rpp = raw_pixels
 */
  __pyx_v_pixels = ((unsigned char *)__pyx_v_surf->pixels);

  /* "renpy/gl/gldraw.pyx":1125
 *         # Copy the pixels from raw_pixels to the surface.
 *         pixels = <unsigned char *> surf.pixels
 *         pitch = surf.pitch             # <<<<<<<<<<<<<<
 *         rpp = raw_pixels
 * 
 */
  __pyx_t_7 = __pyx_v_surf->pitch;
  __pyx_v_pitch = __pyx_t_7;

  /* "renpy/gl/gldraw.pyx":1126
 *         pixels = <unsigned char *> surf.pixels
 *         pitch = surf.pitch
 *         rpp = raw_pixels             # <<<<<<<<<<<<<<
 * 
 *         for y from 0 <= y < surf.h:
 */
  __pyx_v_rpp = __pyx_v_raw_pixels;

  /* "renpy/gl/gldraw.pyx":1128
 *         rpp = raw_pixels
 * 
 *         for y from 0 <= y < surf.h:             # <<<<<<<<<<<<<<
 *             for x from 0 <= x < (surf.w * 4):
 *                 pixels[x] = rpp[x]
 */
  __pyx_t_7 = __pyx_v_surf->h;
  for (__pyx_v_y = 0; __pyx_v_y < __pyx_t_7; __pyx_v_y++) {

    /* "renpy/gl/gldraw.pyx":1129
 * 
 *         for y from 0 <= y < surf.h:
 *             for x from 0 <= x < (surf.w * 4):             # <<<<<<<<<<<<<<
 *                 pixels[x] = rpp[x]
 * 
 */
    __pyx_t_8 = (__pyx_v_surf->w * 4);
    for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_8; __pyx_v_x++) {

      /* "renpy/gl/gldraw.pyx":1130
 *         for y from 0 <= y < surf.h:
 *             for x from 0 <= x < (surf.w * 4):
 *                 pixels[x] = rpp[x]             # <<<<<<<<<<<<<<
 * 
 *             pixels += pitch
 */
      (__pyx_v_pixels[__pyx_v_x]) = (__pyx_v_rpp[__pyx_v_x]);
    }

    /* "renpy/gl/gldraw.pyx":1132
 *                 pixels[x] = rpp[x]
 * 
 *             pixels += pitch             # <<<<<<<<<<<<<<
 *             rpp += surf.w * 4
 * 
 */
    __pyx_v_pixels = (__pyx_v_pixels + __pyx_v_pitch);

    /* "renpy/gl/gldraw.pyx":1133
 * 
 *             pixels += pitch
 *             rpp += surf.w * 4             # <<<<<<<<<<<<<<
 * 
 *         free(raw_pixels)
 */
    __pyx_v_rpp = (__pyx_v_rpp + (__pyx_v_surf->w * 4));
  }

  /* "renpy/gl/gldraw.pyx":1135
 *             rpp += surf.w * 4
 * 
 *         free(raw_pixels)             # <<<<<<<<<<<<<<
 * 
 *         # Crop and flip it, since it's upside down.
 */
  free(__pyx_v_raw_pixels);

  /* "renpy/gl/gldraw.pyx":1138
 * 
 *         # Crop and flip it, since it's upside down.
 *         rv = full.subsurface(self.physical_box)             # <<<<<<<<<<<<<<
 *         rv = renpy.display.pgrender.flip_unscaled(rv, False, True)
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_full, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->physical_box));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self->physical_box));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self->physical_box));
  __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_rv = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/gl/gldraw.pyx":1139
 *         # Crop and flip it, since it's upside down.
 *         rv = full.subsurface(self.physical_box)
 *         rv = renpy.display.pgrender.flip_unscaled(rv, False, True)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__flip_unscaled); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_rv);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_rv);
  __Pyx_GIVEREF(__pyx_v_rv);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_3 = 0;
  __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __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_SET(__pyx_v_rv, __pyx_t_6);
  __pyx_t_6 = 0;

  /* "renpy/gl/gldraw.pyx":1141
 *         rv = renpy.display.pgrender.flip_unscaled(rv, False, True)
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def free_memory(self):
 */
  __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_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.screenshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_full);
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_53free_memory(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_53free_memory(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("free_memory (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_52free_memory(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1143
 *         return rv
 * 
 *     def free_memory(self):             # <<<<<<<<<<<<<<
 *         self.texture_cache.clear()
 *         gltexture.dealloc_textures()
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_52free_memory(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("free_memory", 0);

  /* "renpy/gl/gldraw.pyx":1144
 * 
 *     def free_memory(self):
 *         self.texture_cache.clear()             # <<<<<<<<<<<<<<
 *         gltexture.dealloc_textures()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->texture_cache, __pyx_n_s__clear); 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);
  __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 = 1144; __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/gl/gldraw.pyx":1145
 *     def free_memory(self):
 *         self.texture_cache.clear()
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 * 
 *     def event_peek_sleep(self):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__gltexture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__dealloc_textures); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; __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 = 1145; __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;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_55event_peek_sleep(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_55event_peek_sleep(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("event_peek_sleep (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_54event_peek_sleep(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1147
 *         gltexture.dealloc_textures()
 * 
 *     def event_peek_sleep(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_54event_peek_sleep(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("event_peek_sleep", 0);

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_57get_physical_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_57get_physical_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_physical_size (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_56get_physical_size(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1150
 *         pass
 * 
 *     def get_physical_size(self):             # <<<<<<<<<<<<<<
 *         return self.physical_size
 * 
 */

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

  /* "renpy/gl/gldraw.pyx":1151
 * 
 *     def get_physical_size(self):
 *         return self.physical_size             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->physical_size));
  __pyx_r = ((PyObject *)__pyx_v_self->physical_size);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":30
 *     cdef bint did_init
 *     cdef Environ environ
 *     cdef public object rtt             # <<<<<<<<<<<<<<
 *     cdef object window
 *     cdef tuple virtual_size
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->rtt);
  __pyx_r = __pyx_v_self->rtt;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->rtt);
  __Pyx_DECREF(__pyx_v_self->rtt);
  __pyx_v_self->rtt = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_3rtt_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->rtt);
  __Pyx_DECREF(__pyx_v_self->rtt);
  __pyx_v_self->rtt = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":33
 *     cdef object window
 *     cdef tuple virtual_size
 *     cdef public tuple physical_size             # <<<<<<<<<<<<<<
 *     cdef public tuple virtual_box
 *     cdef public tuple physical_box
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->physical_size));
  __pyx_r = ((PyObject *)__pyx_v_self->physical_size);
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->physical_size);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->physical_size));
  __pyx_v_self->physical_size = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.physical_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_13physical_size_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->physical_size);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->physical_size));
  __pyx_v_self->physical_size = ((PyObject*)Py_None);

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":34
 *     cdef tuple virtual_size
 *     cdef public tuple physical_size
 *     cdef public tuple virtual_box             # <<<<<<<<<<<<<<
 *     cdef public tuple physical_box
 *     cdef object mouse_old_visible
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->virtual_box));
  __pyx_r = ((PyObject *)__pyx_v_self->virtual_box);
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, 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(__pyx_v_self->virtual_box);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->virtual_box));
  __pyx_v_self->virtual_box = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.virtual_box.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->virtual_box);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->virtual_box));
  __pyx_v_self->virtual_box = ((PyObject*)Py_None);

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":35
 *     cdef public tuple physical_size
 *     cdef public tuple virtual_box
 *     cdef public tuple physical_box             # <<<<<<<<<<<<<<
 *     cdef object mouse_old_visible
 *     cdef object mouse_info
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->physical_box));
  __pyx_r = ((PyObject *)__pyx_v_self->physical_box);
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->physical_box);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->physical_box));
  __pyx_v_self->physical_box = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.physical_box.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12physical_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->physical_box);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->physical_box));
  __pyx_v_self->physical_box = ((PyObject*)Py_None);

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":41
 *     cdef double last_redraw_time
 *     cdef double redraw_period
 *     cdef public dict info             # <<<<<<<<<<<<<<
 *     cdef object old_fullscreen
 *     cdef public object fullscreen_surface
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->info));
  __pyx_r = ((PyObject *)__pyx_v_self->info);
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyDict_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->info);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->info));
  __pyx_v_self->info = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.info.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_4info_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->info);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->info));
  __pyx_v_self->info = ((PyObject*)Py_None);

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":43
 *     cdef public dict info
 *     cdef object old_fullscreen
 *     cdef public object fullscreen_surface             # <<<<<<<<<<<<<<
 *     cdef object display_info
 *     cdef double upscale_factor
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_self->fullscreen_surface);
  __pyx_r = __pyx_v_self->fullscreen_surface;
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->fullscreen_surface);
  __Pyx_DECREF(__pyx_v_self->fullscreen_surface);
  __pyx_v_self->fullscreen_surface = __pyx_v_value;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->fullscreen_surface);
  __Pyx_DECREF(__pyx_v_self->fullscreen_surface);
  __pyx_v_self->fullscreen_surface = Py_None;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box___get__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pxd":52
 *     cdef tuple default_clip
 * 
 *     cdef public tuple clip_rtt_box             # <<<<<<<<<<<<<<
 * 
 *     cpdef set_clip(GLDraw self, tuple clip)
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box___get__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self->clip_rtt_box));
  __pyx_r = ((PyObject *)__pyx_v_self->clip_rtt_box);
  goto __pyx_L0;

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

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_2__set__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_2__set__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  if (!(likely(PyTuple_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(__pyx_v_self->clip_rtt_box);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->clip_rtt_box));
  __pyx_v_self->clip_rtt_box = ((PyObject*)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.GLDraw.clip_rtt_box.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_5__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_4__del__(((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_4__del__(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__", 0);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->clip_rtt_box);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->clip_rtt_box));
  __pyx_v_self->clip_rtt_box = ((PyObject*)Py_None);

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_1init(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_1init = {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_1init, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_1init(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_init(__pyx_self, ((PyObject *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1159
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_init(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init", 0);

  /* "renpy/gl/gldraw.pyx":1160
 * 
 *     def init(self):
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def deinit(self):
 */
  __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;
}

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_3deinit(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_3deinit = {__Pyx_NAMESTR("deinit"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_3deinit, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_3deinit(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deinit (wrapper)", 0);
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_2deinit(__pyx_self, ((PyObject *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1162
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_2deinit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deinit", 0);

  /* "renpy/gl/gldraw.pyx":1163
 * 
 *     def deinit(self):
 *         return             # <<<<<<<<<<<<<<
 * 
 *     def render(self, texture, x, y, w, h, draw_func):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_5render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_3Rtt_4render[] = "\n        This function is called to trigger a rendering to a texture.\n        `x`, `y`, `w`, and `h` specify the location and dimensions of\n        the sub-image to render to the texture. `draw_func` is called\n        to render the texture.\n        ";
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_5render = {__Pyx_NAMESTR("render"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_5render, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_3Rtt_4render)};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_5render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_texture = 0;
  CYTHON_UNUSED PyObject *__pyx_v_x = 0;
  CYTHON_UNUSED PyObject *__pyx_v_y = 0;
  CYTHON_UNUSED PyObject *__pyx_v_w = 0;
  CYTHON_UNUSED PyObject *__pyx_v_h = 0;
  CYTHON_UNUSED PyObject *__pyx_v_draw_func = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("render (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__texture,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__w,&__pyx_n_s__h,&__pyx_n_s__draw_func,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__texture)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__draw_func)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "render") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_self = values[0];
    __pyx_v_texture = values[1];
    __pyx_v_x = values[2];
    __pyx_v_y = values[3];
    __pyx_v_w = values[4];
    __pyx_v_h = values[5];
    __pyx_v_draw_func = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.Rtt.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_4render(__pyx_self, __pyx_v_self, __pyx_v_texture, __pyx_v_x, __pyx_v_y, __pyx_v_w, __pyx_v_h, __pyx_v_draw_func);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1165
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_4render(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_texture, CYTHON_UNUSED PyObject *__pyx_v_x, CYTHON_UNUSED PyObject *__pyx_v_y, CYTHON_UNUSED PyObject *__pyx_v_w, CYTHON_UNUSED PyObject *__pyx_v_h, CYTHON_UNUSED PyObject *__pyx_v_draw_func) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("render", 0);

  /* "renpy/gl/gldraw.pyx":1173
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 *     def get_size_limit(self, dimension):
 */
  __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __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 = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

/* Python wrapper */
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_7get_size_limit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_2gl_6gldraw_3Rtt_6get_size_limit[] = "\n        Get the maximum size of a texture.\n        ";
static PyMethodDef __pyx_mdef_5renpy_2gl_6gldraw_3Rtt_7get_size_limit = {__Pyx_NAMESTR("get_size_limit"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_3Rtt_7get_size_limit, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_3Rtt_6get_size_limit)};
static PyObject *__pyx_pw_5renpy_2gl_6gldraw_3Rtt_7get_size_limit(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_dimension = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_size_limit (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__dimension,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        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 (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dimension)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("get_size_limit", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_size_limit") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __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_dimension = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_size_limit", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.gl.gldraw.Rtt.get_size_limit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5renpy_2gl_6gldraw_3Rtt_6get_size_limit(__pyx_self, __pyx_v_self, __pyx_v_dimension);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1175
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */

static PyObject *__pyx_pf_5renpy_2gl_6gldraw_3Rtt_6get_size_limit(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_dimension) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_size_limit", 0);

  /* "renpy/gl/gldraw.pyx":1180
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_83), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __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 = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.gl.gldraw.Rtt.get_size_limit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/gl/gldraw.pyx":1185
 * cdef class Environ(object):
 * 
 *     cdef void blit(self):             # <<<<<<<<<<<<<<
 *         """
 *         Set up a normal blit environment. The texture to be blitted should
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_blit(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blit", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1191
 *         """
 * 
 *     cdef void blend(self, double fraction):             # <<<<<<<<<<<<<<
 *         """
 *         Set up an environment that blends from TEXTURE0 to TEXTURE1.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_blend(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_fraction) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blend", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1198
 *         """
 * 
 *     cdef void imageblend(self, double fraction, int ramp):             # <<<<<<<<<<<<<<
 *         """
 *         Setup an environment that does an imageblend from TEXTURE1 to TEXTURE2.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_imageblend(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_fraction, CYTHON_UNUSED int __pyx_v_ramp) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("imageblend", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1207
 *         """
 * 
 *     cdef void set_vertex(self, float *vertices):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the array of vertices to be shown. Vertices should be an packed
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_vertex(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED float *__pyx_v_vertices) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_vertex", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1213
 *         """
 * 
 *     cdef void set_texture(self, int unit, float *coords):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the array of texture coordinates for unit `unit`.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_texture(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED int __pyx_v_unit, CYTHON_UNUSED float *__pyx_v_coords) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_texture", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1218
 *         """
 * 
 *     cdef void set_color(self, float r, float g, float b, float a):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the color to be shown.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_color(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED float __pyx_v_r, CYTHON_UNUSED float __pyx_v_g, CYTHON_UNUSED float __pyx_v_b, CYTHON_UNUSED float __pyx_v_a) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_color", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1223
 *         """
 * 
 *     cdef void set_clip(self, tuple clip_box, GLDraw draw):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the clipping rectangle.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_set_clip(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_clip_box, CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_draw) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_clip", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1228
 *         """
 * 
 *     cdef void unset_clip(self, GLDraw draw):             # <<<<<<<<<<<<<<
 *         """
 *         Removes the clipping rectangle.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_unset_clip(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *__pyx_v_draw) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unset_clip", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1233
 *         """
 * 
 *     cdef void ortho(self, double left, double right, double bottom, double top, double near, double far):             # <<<<<<<<<<<<<<
 *         """
 *         Enables orthographic projection. `left`, `right`, `top`, `bottom` are the coordinates of the various
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_ortho(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED double __pyx_v_left, CYTHON_UNUSED double __pyx_v_right, CYTHON_UNUSED double __pyx_v_bottom, CYTHON_UNUSED double __pyx_v_top, CYTHON_UNUSED double __pyx_v_near, CYTHON_UNUSED double __pyx_v_far) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ortho", 0);

  __Pyx_RefNannyFinishContext();
}

/* "renpy/gl/gldraw.pyx":1239
 *         """
 * 
 *     cdef void viewport(self, int x, int y, int w, int h):             # <<<<<<<<<<<<<<
 *         """
 *         Sets the GL viewport.
 */

static void __pyx_f_5renpy_2gl_6gldraw_7Environ_viewport(CYTHON_UNUSED struct __pyx_obj_5renpy_2gl_6gldraw_Environ *__pyx_v_self, CYTHON_UNUSED int __pyx_v_x, CYTHON_UNUSED int __pyx_v_y, CYTHON_UNUSED int __pyx_v_w, CYTHON_UNUSED int __pyx_v_h) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("viewport", 0);

  __Pyx_RefNannyFinishContext();
}

/* "gl.pxd":1546
 * 
 * 
 * cdef inline gl_check(where):             # <<<<<<<<<<<<<<
 *     cdef GLenum error
 *     error = glGetError()
 */

static CYTHON_INLINE PyObject *__pyx_f_5renpy_2gl_2gl_gl_check(PyObject *__pyx_v_where) {
  GLenum __pyx_v_error;
  PyObject *__pyx_v_renpy = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("gl_check", 0);

  /* "gl.pxd":1548
 * cdef inline gl_check(where):
 *     cdef GLenum error
 *     error = glGetError()             # <<<<<<<<<<<<<<
 *     if error:
 *         import renpy
 */
  __pyx_v_error = glGetError();

  /* "gl.pxd":1549
 *     cdef GLenum error
 *     error = glGetError()
 *     if error:             # <<<<<<<<<<<<<<
 *         import renpy
 *         renpy.display.log.write("GL error 0x%X at %s", error, where)
 */
  __pyx_t_1 = (__pyx_v_error != 0);
  if (__pyx_t_1) {

    /* "gl.pxd":1550
 *     error = glGetError()
 *     if error:
 *         import renpy             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("GL error 0x%X at %s", error, where)
 */
    __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__renpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_renpy = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "gl.pxd":1551
 *     if error:
 *         import renpy
 *         renpy.display.log.write("GL error 0x%X at %s", error, where)             # <<<<<<<<<<<<<<
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_renpy, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyInt_to_py_GLenum(__pyx_v_error); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_84));
    PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_s_84));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_84));
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_where);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_where);
    __Pyx_GIVEREF(__pyx_v_where);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1551; __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_4)); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.gl.gl.gl_check", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_renpy);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_5renpy_2gl_6gldraw_GLDraw __pyx_vtable_5renpy_2gl_6gldraw_GLDraw;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_GLDraw(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_2gl_6gldraw_GLDraw;
  p->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)Py_None); Py_INCREF(Py_None);
  p->rtt = Py_None; Py_INCREF(Py_None);
  p->window = Py_None; Py_INCREF(Py_None);
  p->virtual_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->physical_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->virtual_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->physical_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->mouse_old_visible = Py_None; Py_INCREF(Py_None);
  p->mouse_info = Py_None; Py_INCREF(Py_None);
  p->texture_cache = Py_None; Py_INCREF(Py_None);
  p->info = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->old_fullscreen = Py_None; Py_INCREF(Py_None);
  p->fullscreen_surface = Py_None; Py_INCREF(Py_None);
  p->display_info = Py_None; Py_INCREF(Py_None);
  p->clip_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->default_clip = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->clip_rtt_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw_GLDraw(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->environ);
  Py_CLEAR(p->rtt);
  Py_CLEAR(p->window);
  Py_CLEAR(p->virtual_size);
  Py_CLEAR(p->physical_size);
  Py_CLEAR(p->virtual_box);
  Py_CLEAR(p->physical_box);
  Py_CLEAR(p->mouse_old_visible);
  Py_CLEAR(p->mouse_info);
  Py_CLEAR(p->texture_cache);
  Py_CLEAR(p->info);
  Py_CLEAR(p->old_fullscreen);
  Py_CLEAR(p->fullscreen_surface);
  Py_CLEAR(p->display_info);
  Py_CLEAR(p->clip_cache);
  Py_CLEAR(p->default_clip);
  Py_CLEAR(p->clip_rtt_box);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw_GLDraw(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o;
  if (p->environ) {
    e = (*v)(((PyObject*)p->environ), a); if (e) return e;
  }
  if (p->rtt) {
    e = (*v)(p->rtt, a); if (e) return e;
  }
  if (p->window) {
    e = (*v)(p->window, a); if (e) return e;
  }
  if (p->virtual_size) {
    e = (*v)(p->virtual_size, a); if (e) return e;
  }
  if (p->physical_size) {
    e = (*v)(p->physical_size, a); if (e) return e;
  }
  if (p->virtual_box) {
    e = (*v)(p->virtual_box, a); if (e) return e;
  }
  if (p->physical_box) {
    e = (*v)(p->physical_box, a); if (e) return e;
  }
  if (p->mouse_old_visible) {
    e = (*v)(p->mouse_old_visible, a); if (e) return e;
  }
  if (p->mouse_info) {
    e = (*v)(p->mouse_info, a); if (e) return e;
  }
  if (p->texture_cache) {
    e = (*v)(p->texture_cache, a); if (e) return e;
  }
  if (p->info) {
    e = (*v)(p->info, a); if (e) return e;
  }
  if (p->old_fullscreen) {
    e = (*v)(p->old_fullscreen, a); if (e) return e;
  }
  if (p->fullscreen_surface) {
    e = (*v)(p->fullscreen_surface, a); if (e) return e;
  }
  if (p->display_info) {
    e = (*v)(p->display_info, a); if (e) return e;
  }
  if (p->clip_cache) {
    e = (*v)(p->clip_cache, a); if (e) return e;
  }
  if (p->default_clip) {
    e = (*v)(p->default_clip, a); if (e) return e;
  }
  if (p->clip_rtt_box) {
    e = (*v)(p->clip_rtt_box, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw_GLDraw(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->environ);
  p->environ = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->rtt);
  p->rtt = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->window);
  p->window = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->virtual_size);
  p->virtual_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->physical_size);
  p->physical_size = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->virtual_box);
  p->virtual_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->physical_box);
  p->physical_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mouse_old_visible);
  p->mouse_old_visible = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->mouse_info);
  p->mouse_info = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->texture_cache);
  p->texture_cache = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->info);
  p->info = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->old_fullscreen);
  p->old_fullscreen = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->fullscreen_surface);
  p->fullscreen_surface = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->display_info);
  p->display_info = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->clip_cache);
  p->clip_cache = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->default_clip);
  p->default_clip = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->clip_rtt_box);
  p->clip_rtt_box = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_rtt(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_rtt(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3rtt_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_size(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_size(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13physical_size_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11virtual_box_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_box(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_box(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12physical_box_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_info(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_4info_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_18fullscreen_surface_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_1__get__(o);
}

static int __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_3__set__(o, v);
  }
  else {
    return __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_12clip_rtt_box_5__del__(o);
  }
}

static PyMethodDef __pyx_methods_5renpy_2gl_6gldraw_GLDraw[] = {
  {__Pyx_NAMESTR("set_mode"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_3set_mode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_2set_mode)},
  {__Pyx_NAMESTR("deinit"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_5deinit, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_4deinit)},
  {__Pyx_NAMESTR("quit"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_7quit, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_9init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_8init)},
  {__Pyx_NAMESTR("should_redraw"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_11should_redraw, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_10should_redraw)},
  {__Pyx_NAMESTR("mutated_surface"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_13mutated_surface, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("load_texture"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_15load_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_14load_texture)},
  {__Pyx_NAMESTR("solid_texture"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_17solid_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clip_mode_screen"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_19clip_mode_screen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_18clip_mode_screen)},
  {__Pyx_NAMESTR("clip_mode_rtt"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_21clip_mode_rtt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_20clip_mode_rtt)},
  {__Pyx_NAMESTR("set_clip"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_23set_clip, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("draw_screen"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_25draw_screen, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_24draw_screen)},
  {__Pyx_NAMESTR("draw_render_textures"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_27draw_render_textures, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_26draw_render_textures)},
  {__Pyx_NAMESTR("draw_transformed"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_29draw_transformed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("render_to_texture"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_31render_to_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("is_pixel_opaque"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_33is_pixel_opaque, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_32is_pixel_opaque)},
  {__Pyx_NAMESTR("get_half"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_35get_half, METH_O, __Pyx_DOCSTR(__pyx_doc_5renpy_2gl_6gldraw_6GLDraw_34get_half)},
  {__Pyx_NAMESTR("update_mouse"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_37update_mouse, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("translate_mouse"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_39translate_mouse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("untranslate_mouse"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_41untranslate_mouse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("mouse_event"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_43mouse_event, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_mouse_pos"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_45get_mouse_pos, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("set_mouse_pos"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_47set_mouse_pos, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("draw_mouse"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_49draw_mouse, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("screenshot"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_51screenshot, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("free_memory"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_53free_memory, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("event_peek_sleep"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_55event_peek_sleep, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_physical_size"), (PyCFunction)__pyx_pw_5renpy_2gl_6gldraw_6GLDraw_57get_physical_size, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5renpy_2gl_6gldraw_GLDraw[] = {
  {(char *)"rtt", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_rtt, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_rtt, 0, 0},
  {(char *)"physical_size", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_size, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_size, 0, 0},
  {(char *)"virtual_box", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_virtual_box, 0, 0},
  {(char *)"physical_box", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_physical_box, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_physical_box, 0, 0},
  {(char *)"info", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_info, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_info, 0, 0},
  {(char *)"fullscreen_surface", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_fullscreen_surface, 0, 0},
  {(char *)"clip_rtt_box", __pyx_getprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box, __pyx_setprop_5renpy_2gl_6gldraw_6GLDraw_clip_rtt_box, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw_GLDraw = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.gl.gldraw.GLDraw"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw_GLDraw, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw_GLDraw, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw_GLDraw, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_2gl_6gldraw_GLDraw, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5renpy_2gl_6gldraw_GLDraw, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_5renpy_2gl_6gldraw_6GLDraw_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw_GLDraw, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct__init[8];
static int __pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init = 0;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *p;
  PyObject *o;
  if (likely((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init)))) {
    o = (PyObject*)__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct__init[--__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init];
    memset(o, 0, sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init));
    PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o);
  p->__pyx_v_extensions = 0;
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_extensions);
  if ((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init))) {
    __pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct__init[__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct__init++] = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o;
  if (p->__pyx_v_extensions) {
    e = (*v)(p->__pyx_v_extensions, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct__init(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_extensions);
  p->__pyx_v_extensions = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5renpy_2gl_6gldraw___pyx_scope_struct__init[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct__init = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.gl.gldraw.__pyx_scope_struct__init"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct__init), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct__init, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture[8];
static int __pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = 0;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *p;
  PyObject *o;
  if (likely((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture)))) {
    o = (PyObject*)__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture[--__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture];
    memset(o, 0, sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture));
    PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o);
  p->__pyx_v_alpha = 0;
  p->__pyx_v_reverse = 0;
  p->__pyx_v_self = 0;
  p->__pyx_v_what = 0;
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_alpha);
  Py_CLEAR(p->__pyx_v_reverse);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_what);
  if ((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture))) {
    __pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture[__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture++] = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o;
  if (p->__pyx_v_alpha) {
    e = (*v)(p->__pyx_v_alpha, a); if (e) return e;
  }
  if (p->__pyx_v_reverse) {
    e = (*v)(p->__pyx_v_reverse, a); if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e;
  }
  if (p->__pyx_v_what) {
    e = (*v)(p->__pyx_v_what, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_alpha);
  p->__pyx_v_alpha = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_reverse);
  p->__pyx_v_reverse = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_what);
  p->__pyx_v_what = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.gl.gldraw.__pyx_scope_struct_1_render_to_texture"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half[8];
static int __pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half = 0;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *p;
  PyObject *o;
  if (likely((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half)))) {
    o = (PyObject*)__pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half[--__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half];
    memset(o, 0, sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half));
    PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  p = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *)o);
  p->__pyx_v_draw = 0;
  p->__pyx_v_height = 0;
  p->__pyx_v_reverse = 0;
  p->__pyx_v_what = 0;
  p->__pyx_v_width = 0;
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_draw);
  Py_CLEAR(p->__pyx_v_height);
  Py_CLEAR(p->__pyx_v_reverse);
  Py_CLEAR(p->__pyx_v_what);
  Py_CLEAR(p->__pyx_v_width);
  if ((__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half))) {
    __pyx_freelist_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half[__pyx_freecount_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half++] = ((struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *)o;
  if (p->__pyx_v_draw) {
    e = (*v)(((PyObject*)p->__pyx_v_draw), a); if (e) return e;
  }
  if (p->__pyx_v_height) {
    e = (*v)(p->__pyx_v_height, a); if (e) return e;
  }
  if (p->__pyx_v_reverse) {
    e = (*v)(p->__pyx_v_reverse, a); if (e) return e;
  }
  if (p->__pyx_v_what) {
    e = (*v)(p->__pyx_v_what, a); if (e) return e;
  }
  if (p->__pyx_v_width) {
    e = (*v)(p->__pyx_v_width, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half(PyObject *o) {
  struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *p = (struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_draw);
  p->__pyx_v_draw = ((struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_height);
  p->__pyx_v_height = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_reverse);
  p->__pyx_v_reverse = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_what);
  p->__pyx_v_what = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_width);
  p->__pyx_v_width = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.gl.gldraw.__pyx_scope_struct_2_get_half"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half, /*tp_traverse*/
  __pyx_tp_clear_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  0, /*tp_finalize*/
  #endif
};
static struct __pyx_vtabstruct_5renpy_2gl_6gldraw_Environ __pyx_vtable_5renpy_2gl_6gldraw_Environ;

static PyObject *__pyx_tp_new_5renpy_2gl_6gldraw_Environ(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5renpy_2gl_6gldraw_Environ *p;
  PyObject *o;
  o = (*t->tp_alloc)(t, 0);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5renpy_2gl_6gldraw_Environ *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_2gl_6gldraw_Environ;
  return o;
}

static void __pyx_tp_dealloc_5renpy_2gl_6gldraw_Environ(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_5renpy_2gl_6gldraw_Environ[] = {
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_5renpy_2gl_6gldraw_Environ = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.gl.gldraw.Environ"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_2gl_6gldraw_Environ), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_2gl_6gldraw_Environ, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_2gl_6gldraw_Environ, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_2gl_6gldraw_Environ, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
  #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    __Pyx_NAMESTR("gldraw"),
    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_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
  {&__pyx_n_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 1},
  {&__pyx_n_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 1},
  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
  {&__pyx_n_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 1},
  {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1},
  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
  {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0},
  {&__pyx_n_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 1},
  {&__pyx_n_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 1},
  {&__pyx_kp_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 0},
  {&__pyx_n_s_47, __pyx_k_47, sizeof(__pyx_k_47), 0, 0, 1, 1},
  {&__pyx_n_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 1},
  {&__pyx_kp_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_n_s_51, __pyx_k_51, sizeof(__pyx_k_51), 0, 0, 1, 1},
  {&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
  {&__pyx_kp_s_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 0, 1, 0},
  {&__pyx_n_s_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 0, 1, 1},
  {&__pyx_n_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 1},
  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
  {&__pyx_kp_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 0},
  {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
  {&__pyx_n_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 1},
  {&__pyx_n_s_70, __pyx_k_70, sizeof(__pyx_k_70), 0, 0, 1, 1},
  {&__pyx_kp_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 0},
  {&__pyx_n_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 1},
  {&__pyx_n_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 1},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_n_s_80, __pyx_k_80, sizeof(__pyx_k_80), 0, 0, 1, 1},
  {&__pyx_kp_s_81, __pyx_k_81, sizeof(__pyx_k_81), 0, 0, 1, 0},
  {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0},
  {&__pyx_n_s_85, __pyx_k_85, sizeof(__pyx_k_85), 0, 0, 1, 1},
  {&__pyx_kp_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 0},
  {&__pyx_n_s_89, __pyx_k_89, sizeof(__pyx_k_89), 0, 0, 1, 1},
  {&__pyx_n_s_92, __pyx_k_92, sizeof(__pyx_k_92), 0, 0, 1, 1},
  {&__pyx_n_s_95, __pyx_k_95, sizeof(__pyx_k_95), 0, 0, 1, 1},
  {&__pyx_n_s_98, __pyx_k_98, sizeof(__pyx_k_98), 0, 0, 1, 1},
  {&__pyx_kp_s_99, __pyx_k_99, sizeof(__pyx_k_99), 0, 0, 1, 0},
  {&__pyx_kp_s__1, __pyx_k__1, sizeof(__pyx_k__1), 0, 0, 1, 0},
  {&__pyx_n_s__BLACKLIST, __pyx_k__BLACKLIST, sizeof(__pyx_k__BLACKLIST), 0, 0, 1, 1},
  {&__pyx_n_s__CopyRtt, __pyx_k__CopyRtt, sizeof(__pyx_k__CopyRtt), 0, 0, 1, 1},
  {&__pyx_n_s__DISSOLVE, __pyx_k__DISSOLVE, sizeof(__pyx_k__DISSOLVE), 0, 0, 1, 1},
  {&__pyx_n_s__DOUBLEBUF, __pyx_k__DOUBLEBUF, sizeof(__pyx_k__DOUBLEBUF), 0, 0, 1, 1},
  {&__pyx_n_s__Exception, __pyx_k__Exception, sizeof(__pyx_k__Exception), 0, 0, 1, 1},
  {&__pyx_n_s__FULLSCREEN, __pyx_k__FULLSCREEN, sizeof(__pyx_k__FULLSCREEN), 0, 0, 1, 1},
  {&__pyx_n_s__FboRtt, __pyx_k__FboRtt, sizeof(__pyx_k__FboRtt), 0, 0, 1, 1},
  {&__pyx_n_s__GLError, __pyx_k__GLError, sizeof(__pyx_k__GLError), 0, 0, 1, 1},
  {&__pyx_n_s__GL_ALPHA_SIZE, __pyx_k__GL_ALPHA_SIZE, sizeof(__pyx_k__GL_ALPHA_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s__GL_SWAP_CONTROL, __pyx_k__GL_SWAP_CONTROL, sizeof(__pyx_k__GL_SWAP_CONTROL), 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__ImportError, __pyx_k__ImportError, sizeof(__pyx_k__ImportError), 0, 0, 1, 1},
  {&__pyx_n_s__LimitedEnviron, __pyx_k__LimitedEnviron, sizeof(__pyx_k__LimitedEnviron), 0, 0, 1, 1},
  {&__pyx_n_s__Matrix2D, __pyx_k__Matrix2D, sizeof(__pyx_k__Matrix2D), 0, 0, 1, 1},
  {&__pyx_n_s__OPENGL, __pyx_k__OPENGL, sizeof(__pyx_k__OPENGL), 0, 0, 1, 1},
  {&__pyx_n_s__PIXELLATE, __pyx_k__PIXELLATE, sizeof(__pyx_k__PIXELLATE), 0, 0, 1, 1},
  {&__pyx_n_s__RENPY_GL_ENVIRON, __pyx_k__RENPY_GL_ENVIRON, sizeof(__pyx_k__RENPY_GL_ENVIRON), 0, 0, 1, 1},
  {&__pyx_n_s__RENPY_GL_RTT, __pyx_k__RENPY_GL_RTT, sizeof(__pyx_k__RENPY_GL_RTT), 0, 0, 1, 1},
  {&__pyx_n_s__RENPY_GL_VSYNC, __pyx_k__RENPY_GL_VSYNC, sizeof(__pyx_k__RENPY_GL_VSYNC), 0, 0, 1, 1},
  {&__pyx_n_s__RESIZABLE, __pyx_k__RESIZABLE, sizeof(__pyx_k__RESIZABLE), 0, 0, 1, 1},
  {&__pyx_n_s__Rtt, __pyx_k__Rtt, sizeof(__pyx_k__Rtt), 0, 0, 1, 1},
  {&__pyx_n_s__ShaderEnviron, __pyx_k__ShaderEnviron, sizeof(__pyx_k__ShaderEnviron), 0, 0, 1, 1},
  {&__pyx_n_s__Surface, __pyx_k__Surface, sizeof(__pyx_k__Surface), 0, 0, 1, 1},
  {&__pyx_n_s__WeakKeyDictionary, __pyx_k__WeakKeyDictionary, sizeof(__pyx_k__WeakKeyDictionary), 0, 0, 1, 1},
  {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
  {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____metaclass__, __pyx_k____metaclass__, sizeof(__pyx_k____metaclass__), 0, 0, 1, 1},
  {&__pyx_n_s____module__, __pyx_k____module__, sizeof(__pyx_k____module__), 0, 0, 1, 1},
  {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1},
  {&__pyx_n_s____qualname__, __pyx_k____qualname__, sizeof(__pyx_k____qualname__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__additive, __pyx_k__additive, sizeof(__pyx_k__additive), 0, 0, 1, 1},
  {&__pyx_n_s__allow_fixed, __pyx_k__allow_fixed, sizeof(__pyx_k__allow_fixed), 0, 0, 1, 1},
  {&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1},
  {&__pyx_n_s__android, __pyx_k__android, sizeof(__pyx_k__android), 0, 0, 1, 1},
  {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
  {&__pyx_n_s__audio, __pyx_k__audio, sizeof(__pyx_k__audio), 0, 0, 1, 1},
  {&__pyx_n_s__cleanup, __pyx_k__cleanup, sizeof(__pyx_k__cleanup), 0, 0, 1, 1},
  {&__pyx_n_s__clear, __pyx_k__clear, sizeof(__pyx_k__clear), 0, 0, 1, 1},
  {&__pyx_n_s__clip, __pyx_k__clip, sizeof(__pyx_k__clip), 0, 0, 1, 1},
  {&__pyx_n_s__clip_mode_rtt, __pyx_k__clip_mode_rtt, sizeof(__pyx_k__clip_mode_rtt), 0, 0, 1, 1},
  {&__pyx_n_s__clip_mode_screen, __pyx_k__clip_mode_screen, sizeof(__pyx_k__clip_mode_screen), 0, 0, 1, 1},
  {&__pyx_n_s__color, __pyx_k__color, sizeof(__pyx_k__color), 0, 0, 1, 1},
  {&__pyx_n_s__config, __pyx_k__config, sizeof(__pyx_k__config), 0, 0, 1, 1},
  {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1},
  {&__pyx_n_s__current_h, __pyx_k__current_h, sizeof(__pyx_k__current_h), 0, 0, 1, 1},
  {&__pyx_n_s__current_w, __pyx_k__current_w, sizeof(__pyx_k__current_w), 0, 0, 1, 1},
  {&__pyx_n_s__dealloc_textures, __pyx_k__dealloc_textures, sizeof(__pyx_k__dealloc_textures), 0, 0, 1, 1},
  {&__pyx_n_s__deinit, __pyx_k__deinit, sizeof(__pyx_k__deinit), 0, 0, 1, 1},
  {&__pyx_n_s__dimension, __pyx_k__dimension, sizeof(__pyx_k__dimension), 0, 0, 1, 1},
  {&__pyx_n_s__display, __pyx_k__display, sizeof(__pyx_k__display), 0, 0, 1, 1},
  {&__pyx_n_s__draw_func, __pyx_k__draw_func, sizeof(__pyx_k__draw_func), 0, 0, 1, 1},
  {&__pyx_n_s__draw_mouse, __pyx_k__draw_mouse, sizeof(__pyx_k__draw_mouse), 0, 0, 1, 1},
  {&__pyx_n_s__draw_screen, __pyx_k__draw_screen, sizeof(__pyx_k__draw_screen), 0, 0, 1, 1},
  {&__pyx_n_s__draw_transformed, __pyx_k__draw_transformed, sizeof(__pyx_k__draw_transformed), 0, 0, 1, 1},
  {&__pyx_n_s__environ, __pyx_k__environ, sizeof(__pyx_k__environ), 0, 0, 1, 1},
  {&__pyx_n_s__envval, __pyx_k__envval, sizeof(__pyx_k__envval), 0, 0, 1, 1},
  {&__pyx_n_s__envvar, __pyx_k__envvar, sizeof(__pyx_k__envvar), 0, 0, 1, 1},
  {&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
  {&__pyx_n_s__exception, __pyx_k__exception, sizeof(__pyx_k__exception), 0, 0, 1, 1},
  {&__pyx_n_s__fbo, __pyx_k__fbo, sizeof(__pyx_k__fbo), 0, 0, 1, 1},
  {&__pyx_n_s__fill, __pyx_k__fill, sizeof(__pyx_k__fill), 0, 0, 1, 1},
  {&__pyx_n_s__first_pass, __pyx_k__first_pass, sizeof(__pyx_k__first_pass), 0, 0, 1, 1},
  {&__pyx_n_s__fixed, __pyx_k__fixed, sizeof(__pyx_k__fixed), 0, 0, 1, 1},
  {&__pyx_n_s__flip, __pyx_k__flip, sizeof(__pyx_k__flip), 0, 0, 1, 1},
  {&__pyx_n_s__flip_unscaled, __pyx_k__flip_unscaled, sizeof(__pyx_k__flip_unscaled), 0, 0, 1, 1},
  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
  {&__pyx_n_s__fullscreen, __pyx_k__fullscreen, sizeof(__pyx_k__fullscreen), 0, 0, 1, 1},
  {&__pyx_n_s__fullscreen_video, __pyx_k__fullscreen_video, sizeof(__pyx_k__fullscreen_video), 0, 0, 1, 1},
  {&__pyx_n_s__game, __pyx_k__game, sizeof(__pyx_k__game), 0, 0, 1, 1},
  {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1},
  {&__pyx_n_s__get_half, __pyx_k__get_half, sizeof(__pyx_k__get_half), 0, 0, 1, 1},
  {&__pyx_n_s__get_info, __pyx_k__get_info, sizeof(__pyx_k__get_info), 0, 0, 1, 1},
  {&__pyx_n_s__get_mouse_info, __pyx_k__get_mouse_info, sizeof(__pyx_k__get_mouse_info), 0, 0, 1, 1},
  {&__pyx_n_s__get_playing, __pyx_k__get_playing, sizeof(__pyx_k__get_playing), 0, 0, 1, 1},
  {&__pyx_n_s__get_pos, __pyx_k__get_pos, sizeof(__pyx_k__get_pos), 0, 0, 1, 1},
  {&__pyx_n_s__get_size, __pyx_k__get_size, sizeof(__pyx_k__get_size), 0, 0, 1, 1},
  {&__pyx_n_s__get_size_limit, __pyx_k__get_size_limit, sizeof(__pyx_k__get_size_limit), 0, 0, 1, 1},
  {&__pyx_n_s__gl, __pyx_k__gl, sizeof(__pyx_k__gl), 0, 0, 1, 1},
  {&__pyx_n_s__gl_enable, __pyx_k__gl_enable, sizeof(__pyx_k__gl_enable), 0, 0, 1, 1},
  {&__pyx_n_s__gl_resize, __pyx_k__gl_resize, sizeof(__pyx_k__gl_resize), 0, 0, 1, 1},
  {&__pyx_n_s__gl_set_attribute, __pyx_k__gl_set_attribute, sizeof(__pyx_k__gl_set_attribute), 0, 0, 1, 1},
  {&__pyx_n_s__gl_size, __pyx_k__gl_size, sizeof(__pyx_k__gl_size), 0, 0, 1, 1},
  {&__pyx_n_s__glblacklist, __pyx_k__glblacklist, sizeof(__pyx_k__glblacklist), 0, 0, 1, 1},
  {&__pyx_n_s__glenviron_fixed, __pyx_k__glenviron_fixed, sizeof(__pyx_k__glenviron_fixed), 0, 0, 1, 1},
  {&__pyx_n_s__glenviron_limited, __pyx_k__glenviron_limited, sizeof(__pyx_k__glenviron_limited), 0, 0, 1, 1},
  {&__pyx_n_s__glenviron_shader, __pyx_k__glenviron_shader, sizeof(__pyx_k__glenviron_shader), 0, 0, 1, 1},
  {&__pyx_n_s__glrtt_copy, __pyx_k__glrtt_copy, sizeof(__pyx_k__glrtt_copy), 0, 0, 1, 1},
  {&__pyx_n_s__glrtt_fbo, __pyx_k__glrtt_fbo, sizeof(__pyx_k__glrtt_fbo), 0, 0, 1, 1},
  {&__pyx_n_s__gltexture, __pyx_k__gltexture, sizeof(__pyx_k__gltexture), 0, 0, 1, 1},
  {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1},
  {&__pyx_n_s__half_cache, __pyx_k__half_cache, sizeof(__pyx_k__half_cache), 0, 0, 1, 1},
  {&__pyx_n_s__height, __pyx_k__height, sizeof(__pyx_k__height), 0, 0, 1, 1},
  {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
  {&__pyx_n_s__init, __pyx_k__init, sizeof(__pyx_k__init), 0, 0, 1, 1},
  {&__pyx_n_s__interface, __pyx_k__interface, sizeof(__pyx_k__interface), 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__kill, __pyx_k__kill, sizeof(__pyx_k__kill), 0, 0, 1, 1},
  {&__pyx_n_s__kill_textures, __pyx_k__kill_textures, sizeof(__pyx_k__kill_textures), 0, 0, 1, 1},
  {&__pyx_n_s__limited, __pyx_k__limited, sizeof(__pyx_k__limited), 0, 0, 1, 1},
  {&__pyx_n_s__load_texture, __pyx_k__load_texture, sizeof(__pyx_k__load_texture), 0, 0, 1, 1},
  {&__pyx_n_s__log, __pyx_k__log, sizeof(__pyx_k__log), 0, 0, 1, 1},
  {&__pyx_n_s__module, __pyx_k__module, sizeof(__pyx_k__module), 0, 0, 1, 1},
  {&__pyx_n_s__mouse, __pyx_k__mouse, sizeof(__pyx_k__mouse), 0, 0, 1, 1},
  {&__pyx_n_s__movie, __pyx_k__movie, sizeof(__pyx_k__movie), 0, 0, 1, 1},
  {&__pyx_n_s__music, __pyx_k__music, sizeof(__pyx_k__music), 0, 0, 1, 1},
  {&__pyx_n_s__needs_redraw, __pyx_k__needs_redraw, sizeof(__pyx_k__needs_redraw), 0, 0, 1, 1},
  {&__pyx_n_s__non_aligned, __pyx_k__non_aligned, sizeof(__pyx_k__non_aligned), 0, 0, 1, 1},
  {&__pyx_n_s__object, __pyx_k__object, sizeof(__pyx_k__object), 0, 0, 1, 1},
  {&__pyx_n_s__operation_alpha, __pyx_k__operation_alpha, sizeof(__pyx_k__operation_alpha), 0, 0, 1, 1},
  {&__pyx_n_s__operation_complete, __pyx_k__operation_complete, sizeof(__pyx_k__operation_complete), 0, 0, 1, 1},
  {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
  {&__pyx_n_s__over, __pyx_k__over, sizeof(__pyx_k__over), 0, 0, 1, 1},
  {&__pyx_n_s__pgrender, __pyx_k__pgrender, sizeof(__pyx_k__pgrender), 0, 0, 1, 1},
  {&__pyx_n_s__physical_size, __pyx_k__physical_size, sizeof(__pyx_k__physical_size), 0, 0, 1, 1},
  {&__pyx_n_s__pos, __pyx_k__pos, sizeof(__pyx_k__pos), 0, 0, 1, 1},
  {&__pyx_n_s__post_init, __pyx_k__post_init, sizeof(__pyx_k__post_init), 0, 0, 1, 1},
  {&__pyx_n_s__pygame, __pyx_k__pygame, sizeof(__pyx_k__pygame), 0, 0, 1, 1},
  {&__pyx_n_s__quit, __pyx_k__quit, sizeof(__pyx_k__quit), 0, 0, 1, 1},
  {&__pyx_n_s__render, __pyx_k__render, sizeof(__pyx_k__render), 0, 0, 1, 1},
  {&__pyx_n_s__render_movie, __pyx_k__render_movie, sizeof(__pyx_k__render_movie), 0, 0, 1, 1},
  {&__pyx_n_s__render_to_texture, __pyx_k__render_to_texture, sizeof(__pyx_k__render_to_texture), 0, 0, 1, 1},
  {&__pyx_n_s__renderer, __pyx_k__renderer, sizeof(__pyx_k__renderer), 0, 0, 1, 1},
  {&__pyx_n_s__renpy, __pyx_k__renpy, sizeof(__pyx_k__renpy), 0, 0, 1, 1},
  {&__pyx_n_s__req_ext, __pyx_k__req_ext, sizeof(__pyx_k__req_ext), 0, 0, 1, 1},
  {&__pyx_n_s__resizable, __pyx_k__resizable, sizeof(__pyx_k__resizable), 0, 0, 1, 1},
  {&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1},
  {&__pyx_n_s__rtt, __pyx_k__rtt, sizeof(__pyx_k__rtt), 0, 0, 1, 1},
  {&__pyx_n_s__self, __pyx_k__self, sizeof(__pyx_k__self), 0, 0, 1, 1},
  {&__pyx_n_s__set_clip, __pyx_k__set_clip, sizeof(__pyx_k__set_clip), 0, 0, 1, 1},
  {&__pyx_n_s__set_mode, __pyx_k__set_mode, sizeof(__pyx_k__set_mode), 0, 0, 1, 1},
  {&__pyx_n_s__set_pos, __pyx_k__set_pos, sizeof(__pyx_k__set_pos), 0, 0, 1, 1},
  {&__pyx_n_s__set_rgba_masks, __pyx_k__set_rgba_masks, sizeof(__pyx_k__set_rgba_masks), 0, 0, 1, 1},
  {&__pyx_n_s__set_visible, __pyx_k__set_visible, sizeof(__pyx_k__set_visible), 0, 0, 1, 1},
  {&__pyx_n_s__shader, __pyx_k__shader, sizeof(__pyx_k__shader), 0, 0, 1, 1},
  {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1},
  {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1},
  {&__pyx_n_s__subsurface, __pyx_k__subsurface, sizeof(__pyx_k__subsurface), 0, 0, 1, 1},
  {&__pyx_n_s__surf, __pyx_k__surf, sizeof(__pyx_k__surf), 0, 0, 1, 1},
  {&__pyx_n_s__surface, __pyx_k__surface, sizeof(__pyx_k__surface), 0, 0, 1, 1},
  {&__pyx_n_s__surface_unscaled, __pyx_k__surface_unscaled, sizeof(__pyx_k__surface_unscaled), 0, 0, 1, 1},
  {&__pyx_n_s__surftree, __pyx_k__surftree, sizeof(__pyx_k__surftree), 0, 0, 1, 1},
  {&__pyx_n_s__test_texture_sizes, __pyx_k__test_texture_sizes, sizeof(__pyx_k__test_texture_sizes), 0, 0, 1, 1},
  {&__pyx_n_s__texture, __pyx_k__texture, sizeof(__pyx_k__texture), 0, 0, 1, 1},
  {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1},
  {&__pyx_n_s__transient, __pyx_k__transient, sizeof(__pyx_k__transient), 0, 0, 1, 1},
  {&__pyx_n_s__translate_mouse, __pyx_k__translate_mouse, sizeof(__pyx_k__translate_mouse), 0, 0, 1, 1},
  {&__pyx_n_s__untranslate_mouse, __pyx_k__untranslate_mouse, sizeof(__pyx_k__untranslate_mouse), 0, 0, 1, 1},
  {&__pyx_n_s__use_gl, __pyx_k__use_gl, sizeof(__pyx_k__use_gl), 0, 0, 1, 1},
  {&__pyx_n_s__use_gles, __pyx_k__use_gles, sizeof(__pyx_k__use_gles), 0, 0, 1, 1},
  {&__pyx_n_s__use_subsystem, __pyx_k__use_subsystem, sizeof(__pyx_k__use_subsystem), 0, 0, 1, 1},
  {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1},
  {&__pyx_n_s__video, __pyx_k__video, sizeof(__pyx_k__video), 0, 0, 1, 1},
  {&__pyx_n_s__virtual_size, __pyx_k__virtual_size, sizeof(__pyx_k__virtual_size), 0, 0, 1, 1},
  {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1},
  {&__pyx_n_s__weakref, __pyx_k__weakref, sizeof(__pyx_k__weakref), 0, 0, 1, 1},
  {&__pyx_n_s__what, __pyx_k__what, sizeof(__pyx_k__what), 0, 0, 1, 1},
  {&__pyx_n_s__width, __pyx_k__width, sizeof(__pyx_k__width), 0, 0, 1, 1},
  {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__xo, __pyx_k__xo, sizeof(__pyx_k__xo), 0, 0, 1, 1},
  {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
  {&__pyx_n_s__yo, __pyx_k__yo, sizeof(__pyx_k__yo), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetBuiltinName(__pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __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", 0);

  /* "renpy/gl/gldraw.pyx":102
 * 
 *         # The (x, y) and texture of the software mouse.
 *         self.mouse_info = (0, 0, None)             # <<<<<<<<<<<<<<
 * 
 *         # This is used to cache the surface->texture operation.
 */
  __pyx_k_tuple_2 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_0, Py_None); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_2);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));

  /* "renpy/gl/gldraw.pyx":153
 * 
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_4);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));

  /* "renpy/gl/gldraw.pyx":178
 *             renpy.display.interface.post_init()
 * 
 *         renpy.display.log.write("")             # <<<<<<<<<<<<<<
 * 
 *         self.virtual_size = virtual_size
 */
  __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_6);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));

  /* "renpy/gl/gldraw.pyx":207
 * 
 *         # Handle swap control.
 *         vsync = int(os.environ.get("RENPY_GL_VSYNC", "1"))             # <<<<<<<<<<<<<<
 * 
 *         if ANGLE:
 */
  __pyx_k_tuple_7 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__RENPY_GL_VSYNC), ((PyObject *)__pyx_kp_s__1)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_7);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));

  /* "renpy/gl/gldraw.pyx":227
 *         try:
 *             if fullscreen:
 *                 renpy.display.log.write("Fullscreen mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | opengl | pygame.DOUBLEBUF)
 *             else:
 */
  __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_9);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));

  /* "renpy/gl/gldraw.pyx":228
 *             if fullscreen:
 *                 renpy.display.log.write("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | opengl | pygame.DOUBLEBUF)             # <<<<<<<<<<<<<<
 *             else:
 *                 renpy.display.log.write("Windowed mode.")
 */
  __pyx_k_tuple_10 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_0); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_10);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "renpy/gl/gldraw.pyx":230
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | opengl | pygame.DOUBLEBUF)
 *             else:
 *                 renpy.display.log.write("Windowed mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((pwidth, pheight), resizable | opengl | pygame.DOUBLEBUF)
 * 
 */
  __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_12);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));

  /* "renpy/gl/gldraw.pyx":372
 * 
 *         if not allow_shader:
 *             renpy.display.log.write("Shaders are blacklisted.")             # <<<<<<<<<<<<<<
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")
 */
  __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_21);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));

  /* "renpy/gl/gldraw.pyx":374
 *             renpy.display.log.write("Shaders are blacklisted.")
 *         if not allow_fixed:
 *             renpy.display.log.write("Fixed-function is blacklisted.")             # <<<<<<<<<<<<<<
 * 
 *         if not allow_shader and not allow_fixed:
 */
  __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_22)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_23);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));

  /* "renpy/gl/gldraw.pyx":377
 * 
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_24)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_25);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));

  /* "renpy/gl/gldraw.pyx":392
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 *         extensions = set(extensions_string.split(" "))             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Extensions:")
 */
  __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_27);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));

  /* "renpy/gl/gldraw.pyx":394
 *         extensions = set(extensions_string.split(" "))
 * 
 *         renpy.display.log.write("Extensions:")             # <<<<<<<<<<<<<<
 * 
 *         for i in sorted(extensions):
 */
  __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_28)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_29);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));

  /* "renpy/gl/gldraw.pyx":399
 *             renpy.display.log.write("    %s", i)
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):             # <<<<<<<<<<<<<<
 *             """
 *             Decides if we should used a particular subsystem, based on
 */
  __pyx_k_tuple_31 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__module), ((PyObject *)__pyx_n_s__envvar), ((PyObject *)__pyx_n_s__envval), ((PyObject *)__pyx_n_s__req_ext), ((PyObject *)__pyx_n_s__req_ext), ((PyObject *)__pyx_n_s__value), ((PyObject *)__pyx_n_s__i)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_31);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
  __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__use_subsystem, 399, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":441
 * 
 *             try:
 *                 renpy.display.log.write("Using shader environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 */
  __pyx_k_tuple_40 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_39)); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_40);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));

  /* "renpy/gl/gldraw.pyx":447
 * 
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")             # <<<<<<<<<<<<<<
 *                 renpy.display.log.exception()
 *                 self.environ = None
 */
  __pyx_k_tuple_42 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_41)); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_42);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_42));

  /* "renpy/gl/gldraw.pyx":460
 *                 "GL_ARB_texture_env_combine"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
  __pyx_k_tuple_46 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_45)); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_46);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));

  /* "renpy/gl/gldraw.pyx":471
 *                 "GL_NV_texture_env_combine4"):
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
  __pyx_k_tuple_50 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_49)); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_50);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));

  /* "renpy/gl/gldraw.pyx":482
 *                 "RENPY_bogus_extension"):
 * 
 *                 renpy.display.log.write("Using limited environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 */
  __pyx_k_tuple_53 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_52)); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_53);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53));

  /* "renpy/gl/gldraw.pyx":488
 * 
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  __pyx_k_tuple_55 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_54)); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_55);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55));

  /* "renpy/gl/gldraw.pyx":493
 *         # Pick a Render-to-texture method.
 * 
 *         if glrtt_copy and os.environ.get("RENPY_GL_RTT", "copy") == "copy":             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 */
  __pyx_k_tuple_56 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__RENPY_GL_RTT), ((PyObject *)__pyx_n_s__copy)); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_56);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_56));

  /* "renpy/gl/gldraw.pyx":494
 * 
 *         if glrtt_copy and os.environ.get("RENPY_GL_RTT", "copy") == "copy":
 *             renpy.display.log.write("Using copy RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"
 */
  __pyx_k_tuple_58 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_57)); if (unlikely(!__pyx_k_tuple_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_58);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_58));

  /* "renpy/gl/gldraw.pyx":510
 *                 "GL_ARB_framebuffer_object")):
 * 
 *             renpy.display.log.write("Using FBO RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 */
  __pyx_k_tuple_62 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_61)); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_62);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));

  /* "renpy/gl/gldraw.pyx":516
 * 
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_k_tuple_64 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_63)); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_64);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64));

  /* "renpy/gl/gldraw.pyx":651
 *         self.upscale_factor = 1.0 * self.physical_size[0] / self.virtual_size[0]
 * 
 *         if renpy.audio.music.get_playing("movie") and renpy.display.video.fullscreen:             # <<<<<<<<<<<<<<
 *             surf = renpy.display.video.render_movie(self.virtual_size[0], self.virtual_size[1])
 *             if surf is not None:
 */
  __pyx_k_tuple_69 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__movie)); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_69);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));

  /* "renpy/gl/gldraw.pyx":890
 *         forward = reverse = IDENTITY
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */
  __pyx_k_tuple_72 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__x), ((PyObject *)__pyx_n_s__y), ((PyObject *)__pyx_n_s__w), ((PyObject *)__pyx_n_s__h), ((PyObject *)__pyx_n_s__clip)); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_72);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72));
  __pyx_k_codeobj_73 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__draw_func, 890, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":938
 *         self.environ.ortho(0, 1, 0, 1, -1, 1)
 * 
 *         self.clip_mode_rtt(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *         clip = (0, 0, 1, 1)
 */
  __pyx_k_tuple_76 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 938; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_76);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76));

  /* "renpy/gl/gldraw.pyx":940
 *         self.clip_mode_rtt(0, 0, 1, 1)
 * 
 *         clip = (0, 0, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *         self.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)
 */
  __pyx_k_tuple_77 = PyTuple_Pack(4, __pyx_int_0, __pyx_int_0, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_77);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));

  /* "renpy/gl/gldraw.pyx":972
 *         height = max(what.height / 2, 1)
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             glClearColor(0.0, 0.0, 0.0, 1.0)
 */
  __pyx_k_tuple_78 = PyTuple_Pack(5, ((PyObject *)__pyx_n_s__x), ((PyObject *)__pyx_n_s__y), ((PyObject *)__pyx_n_s__w), ((PyObject *)__pyx_n_s__h), ((PyObject *)__pyx_n_s__clip)); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_78);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));
  __pyx_k_codeobj_79 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__draw_func, 972, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":1173
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 *     def get_size_limit(self, dimension):
 */
  __pyx_k_tuple_82 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_81)); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_82);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82));

  /* "renpy/gl/gldraw.pyx":1180
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_k_tuple_83 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_81)); if (unlikely(!__pyx_k_tuple_83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_83);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_83));

  /* "renpy/gl/gldraw.pyx":1159
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_k_tuple_87 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_87);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_87));
  __pyx_k_codeobj_88 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__init, 1159, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":1162
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_k_tuple_90 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__self)); if (unlikely(!__pyx_k_tuple_90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_90);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_90));
  __pyx_k_codeobj_91 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__deinit, 1162, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":1165
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */
  __pyx_k_tuple_93 = PyTuple_Pack(7, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__texture), ((PyObject *)__pyx_n_s__x), ((PyObject *)__pyx_n_s__y), ((PyObject *)__pyx_n_s__w), ((PyObject *)__pyx_n_s__h), ((PyObject *)__pyx_n_s__draw_func)); if (unlikely(!__pyx_k_tuple_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_93);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_93));
  __pyx_k_codeobj_94 = (PyObject*)__Pyx_PyCode_New(7, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__render, 1165, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/gl/gldraw.pyx":1175
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */
  __pyx_k_tuple_96 = PyTuple_Pack(2, ((PyObject *)__pyx_n_s__self), ((PyObject *)__pyx_n_s__dimension)); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_96);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96));
  __pyx_k_codeobj_97 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__get_size_limit, 1175, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_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_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_102 = PyInt_FromLong(102); if (unlikely(!__pyx_int_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) {__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 initgldraw(void); /*proto*/
PyMODINIT_FUNC initgldraw(void)
#else
PyMODINIT_FUNC PyInit_gldraw(void); /*proto*/
PyMODINIT_FUNC PyInit_gldraw(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __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_gldraw(void)", 0);
  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_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_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("gldraw"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "renpy.gl.gldraw")) {
      if (unlikely(PyDict_SetItemString(modules, "renpy.gl.gldraw", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  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 PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_renpy__gl__gldraw) {
    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_2gl_6gldraw_IDENTITY = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_5renpy_2gl_6gldraw_GLDraw = &__pyx_vtable_5renpy_2gl_6gldraw_GLDraw;
  __pyx_vtable_5renpy_2gl_6gldraw_GLDraw.set_clip = (PyObject *(*)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5renpy_2gl_6gldraw_6GLDraw_set_clip;
  __pyx_vtable_5renpy_2gl_6gldraw_GLDraw.draw_render_textures = (int (*)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, int, int __pyx_skip_dispatch))__pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_render_textures;
  __pyx_vtable_5renpy_2gl_6gldraw_GLDraw.draw_transformed = (int (*)(struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *, PyObject *, PyObject *, double, double, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, int __pyx_skip_dispatch))__pyx_f_5renpy_2gl_6gldraw_6GLDraw_draw_transformed;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5renpy_2gl_6gldraw_GLDraw.tp_dict, __pyx_vtabptr_5renpy_2gl_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GLDraw", (PyObject *)&__pyx_type_5renpy_2gl_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_2gl_6gldraw_GLDraw = &__pyx_type_5renpy_2gl_6gldraw_GLDraw;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct__init) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct__init = &__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct__init;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture = &__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_1_render_to_texture;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half = &__pyx_type_5renpy_2gl_6gldraw___pyx_scope_struct_2_get_half;
  __pyx_vtabptr_5renpy_2gl_6gldraw_Environ = &__pyx_vtable_5renpy_2gl_6gldraw_Environ;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.blit = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *))__pyx_f_5renpy_2gl_6gldraw_7Environ_blit;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.blend = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double))__pyx_f_5renpy_2gl_6gldraw_7Environ_blend;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.imageblend = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, int))__pyx_f_5renpy_2gl_6gldraw_7Environ_imageblend;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_vertex = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, float *))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_vertex;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_texture = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, float *))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_texture;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_color = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, float, float, float, float))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_color;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.set_clip = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, PyObject *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *))__pyx_f_5renpy_2gl_6gldraw_7Environ_set_clip;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.unset_clip = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, struct __pyx_obj_5renpy_2gl_6gldraw_GLDraw *))__pyx_f_5renpy_2gl_6gldraw_7Environ_unset_clip;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.ortho = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, double, double, double, double, double, double))__pyx_f_5renpy_2gl_6gldraw_7Environ_ortho;
  __pyx_vtable_5renpy_2gl_6gldraw_Environ.viewport = (void (*)(struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int, int, int))__pyx_f_5renpy_2gl_6gldraw_7Environ_viewport;
  if (PyType_Ready(&__pyx_type_5renpy_2gl_6gldraw_Environ) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5renpy_2gl_6gldraw_Environ.tp_dict, __pyx_vtabptr_5renpy_2gl_6gldraw_Environ) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Environ", (PyObject *)&__pyx_type_5renpy_2gl_6gldraw_Environ) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_2gl_6gldraw_Environ = &__pyx_type_5renpy_2gl_6gldraw_Environ;
  /*--- Type import code ---*/
  __pyx_ptype_5renpy_7display_6render_Matrix2D = __Pyx_ImportType("renpy.display.render", "Matrix2D", sizeof(struct __pyx_obj_5renpy_7display_6render_Matrix2D), 1); if (unlikely(!__pyx_ptype_5renpy_7display_6render_Matrix2D)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_5renpy_7display_6render_Matrix2D = (struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D*)__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6render_Matrix2D->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_7display_6render_Matrix2D)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_6render_Render = __Pyx_ImportType("renpy.display.render", "Render", sizeof(struct __pyx_obj_5renpy_7display_6render_Render), 1); if (unlikely(!__pyx_ptype_5renpy_7display_6render_Render)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_5renpy_7display_6render_Render = (struct __pyx_vtabstruct_5renpy_7display_6render_Render*)__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6render_Render->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_7display_6render_Render)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_2gl_9gltexture_TextureCore = __Pyx_ImportType("renpy.gl.gltexture", "TextureCore", sizeof(struct __pyx_obj_5renpy_2gl_9gltexture_TextureCore), 1); if (unlikely(!__pyx_ptype_5renpy_2gl_9gltexture_TextureCore)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_5renpy_2gl_9gltexture_TextureCore = (struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureCore*)__Pyx_GetVtable(__pyx_ptype_5renpy_2gl_9gltexture_TextureCore->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_2gl_9gltexture_TextureCore)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_2gl_9gltexture_TextureGrid = __Pyx_ImportType("renpy.gl.gltexture", "TextureGrid", sizeof(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid), 1); if (unlikely(!__pyx_ptype_5renpy_2gl_9gltexture_TextureGrid)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_5renpy_2gl_9gltexture_TextureGrid = (struct __pyx_vtabstruct_5renpy_2gl_9gltexture_TextureGrid*)__Pyx_GetVtable(__pyx_ptype_5renpy_2gl_9gltexture_TextureGrid->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_2gl_9gltexture_TextureGrid)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("renpy.gl.gltexture"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "blit", (void (**)(void))&__pyx_f_5renpy_2gl_9gltexture_blit, "PyObject *(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "blend", (void (**)(void))&__pyx_f_5renpy_2gl_9gltexture_blend, "PyObject *(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, double, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_1, "imageblend", (void (**)(void))&__pyx_f_5renpy_2gl_9gltexture_imageblend, "PyObject *(struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_2gl_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, double, int, struct __pyx_obj_5renpy_2gl_6gldraw_Environ *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*--- Execution code ---*/

  /* "renpy/gl/gldraw.pyx":30
 * from gl cimport *
 * 
 * import renpy             # <<<<<<<<<<<<<<
 * import pygame
 * import os
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__renpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__renpy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":31
 * 
 * import renpy
 * import pygame             # <<<<<<<<<<<<<<
 * import os
 * import os.path
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__pygame), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__pygame, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":32
 * import renpy
 * import pygame
 * import os             # <<<<<<<<<<<<<<
 * import os.path
 * import weakref
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); 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);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__os, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":33
 * import pygame
 * import os
 * import os.path             # <<<<<<<<<<<<<<
 * import weakref
 * import array
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_85), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__os, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":34
 * import os
 * import os.path
 * import weakref             # <<<<<<<<<<<<<<
 * import array
 * import time
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__weakref), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__weakref, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":35
 * import os.path
 * import weakref
 * import array             # <<<<<<<<<<<<<<
 * import time
 * 
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__array), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__array, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":36
 * import weakref
 * import array
 * import time             # <<<<<<<<<<<<<<
 * 
 * cimport renpy.display.render as render
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__time, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":40
 * cimport renpy.display.render as render
 * cimport gltexture
 * import gltexture             # <<<<<<<<<<<<<<
 * import glblacklist
 * 
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__gltexture), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__gltexture, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":41
 * cimport gltexture
 * import gltexture
 * import glblacklist             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "glcompat.h":
 */
  __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__glblacklist), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__glblacklist, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":60
 * 
 * # This is used by gl_error_check in gl.pxd.
 * class GLError(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     This is used to report OpenGL errors.
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_86)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2), __pyx_n_s__GLError, __pyx_n_s__GLError, __pyx_n_s_35); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__GLError, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":69
 * # Cache various externals, so we can use them more efficiently.
 * cdef int DISSOLVE, IMAGEDISSOLVE, PIXELLATE
 * DISSOLVE = renpy.display.render.DISSOLVE             # <<<<<<<<<<<<<<
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE
 * PIXELLATE = renpy.display.render.PIXELLATE
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__render); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__DISSOLVE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_5renpy_2gl_6gldraw_DISSOLVE = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":70
 * cdef int DISSOLVE, IMAGEDISSOLVE, PIXELLATE
 * DISSOLVE = renpy.display.render.DISSOLVE
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE             # <<<<<<<<<<<<<<
 * PIXELLATE = renpy.display.render.PIXELLATE
 * 
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__render); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__IMAGEDISSOLVE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_5renpy_2gl_6gldraw_IMAGEDISSOLVE = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":71
 * DISSOLVE = renpy.display.render.DISSOLVE
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE
 * PIXELLATE = renpy.display.render.PIXELLATE             # <<<<<<<<<<<<<<
 * 
 * cdef object IDENTITY
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__render); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__PIXELLATE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_5renpy_2gl_6gldraw_PIXELLATE = __pyx_t_5;

  /* "renpy/gl/gldraw.pyx":74
 * 
 * cdef object IDENTITY
 * IDENTITY = renpy.display.render.IDENTITY             # <<<<<<<<<<<<<<
 * 
 * cdef class GLDraw:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__render); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__IDENTITY); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_XGOTREF(__pyx_v_5renpy_2gl_6gldraw_IDENTITY);
  __Pyx_DECREF_SET(__pyx_v_5renpy_2gl_6gldraw_IDENTITY, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":78
 * cdef class GLDraw:
 * 
 *     def __init__(self, allow_fixed=True):             # <<<<<<<<<<<<<<
 * 
 *         # Did we do the first-time init?
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); 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_k_1 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":569
 *             del self.texture_cache[surf]
 * 
 *     def load_texture(self, surf, transient=False):             # <<<<<<<<<<<<<<
 *         """
 *         Loads a texture into memory.
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_k_66 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":627
 * 
 * 
 *     def draw_screen(self, surftree, fullscreen_video, flip=True):             # <<<<<<<<<<<<<<
 *         """
 *         Draws the screen.
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_k_68 = __pyx_t_2;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1154
 * 
 * 
 * class Rtt(object):             # <<<<<<<<<<<<<<
 *     """
 *     Subclasses of this class handle rendering to a texture.
 */
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));

  /* "renpy/gl/gldraw.pyx":1159
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_1init, 0, __pyx_n_s_89, NULL, __pyx_n_s_35, ((PyObject *)__pyx_k_codeobj_88)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__init, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1162
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_3deinit, 0, __pyx_n_s_92, NULL, __pyx_n_s_35, ((PyObject *)__pyx_k_codeobj_91)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__deinit, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1165
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_5render, 0, __pyx_n_s_95, NULL, __pyx_n_s_35, ((PyObject *)__pyx_k_codeobj_94)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__render, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1175
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */
  __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5renpy_2gl_6gldraw_3Rtt_7get_size_limit, 0, __pyx_n_s_98, NULL, __pyx_n_s_35, ((PyObject *)__pyx_k_codeobj_97)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__get_size_limit, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/gl/gldraw.pyx":1154
 * 
 * 
 * class Rtt(object):             # <<<<<<<<<<<<<<
 *     """
 *     Subclasses of this class handle rendering to a texture.
 */
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_99)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_2), __pyx_n_s__Rtt, __pyx_n_s__Rtt, __pyx_n_s_35); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_d, __pyx_n_s__Rtt, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;

  /* "renpy/gl/gldraw.pyx":1247
 * # These imports need to be down at the bottom, after the Rtt and Environ
 * # classes have been created.
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_copy
 * except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1248
 * # classes have been created.
 * try:
 *     import glrtt_copy             # <<<<<<<<<<<<<<
 * except:
 *     glrtt_copy = None
 */
      __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__glrtt_copy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glrtt_copy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":1249
 * try:
 *     import glrtt_copy
 * except:             # <<<<<<<<<<<<<<
 *     glrtt_copy = None
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "renpy/gl/gldraw.pyx":1250
 *     import glrtt_copy
 * except:
 *     glrtt_copy = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glrtt_copy, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    __pyx_L9_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1252
 *     glrtt_copy = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_fbo
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1253
 * 
 * try:
 *     import glrtt_fbo             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glrtt_fbo = None
 */
      __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s__glrtt_fbo), 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glrtt_fbo, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L19_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":1254
 * try:
 *     import glrtt_fbo
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glrtt_fbo = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "renpy/gl/gldraw.pyx":1255
 *     import glrtt_fbo
 * except ImportError:
 *     glrtt_fbo = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glrtt_fbo, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1255; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L13_exception_handled;
    }
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    __pyx_L19_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1257
 *     glrtt_fbo = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_fixed
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1258
 * 
 * try:
 *     import glenviron_fixed             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_fixed = None
 */
      __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__glenviron_fixed), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glenviron_fixed, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L29_try_end;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":1259
 * try:
 *     import glenviron_fixed
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_fixed = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "renpy/gl/gldraw.pyx":1260
 *     import glenviron_fixed
 * except ImportError:
 *     glenviron_fixed = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glenviron_fixed, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1260; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L23_exception_handled;
    }
    __pyx_L24_except_error:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L23_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    __pyx_L29_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1262
 *     glenviron_fixed = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_shader
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1263
 * 
 * try:
 *     import glenviron_shader             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_shader = None
 */
      __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s__glenviron_shader), 0, -1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_GOTREF(__pyx_t_4);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glenviron_shader, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L39_try_end;
    __pyx_L32_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/gl/gldraw.pyx":1264
 * try:
 *     import glenviron_shader
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_shader = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L34_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_2);

      /* "renpy/gl/gldraw.pyx":1265
 *     import glenviron_shader
 * except ImportError:
 *     glenviron_shader = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glenviron_shader, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L34_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L33_exception_handled;
    }
    __pyx_L34_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L33_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    __pyx_L39_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1267
 *     glenviron_shader = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_limited
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "renpy/gl/gldraw.pyx":1268
 * 
 * try:
 *     import glenviron_limited             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_limited = None
 */
      __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__glenviron_limited), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glenviron_limited, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L49_try_end;
    __pyx_L42_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/gl/gldraw.pyx":1269
 * try:
 *     import glenviron_limited
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_limited = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "renpy/gl/gldraw.pyx":1270
 *     import glenviron_limited
 * except ImportError:
 *     glenviron_limited = None             # <<<<<<<<<<<<<<
 * 
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s__glenviron_limited, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L43_exception_handled;
    }
    __pyx_L44_except_error:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L43_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    __pyx_L49_try_end:;
  }

  /* "renpy/gl/gldraw.pyx":1
 * #cython: profile=False             # <<<<<<<<<<<<<<
 * #@PydevCodeAnalysisIgnore
 * # Copyright 2004-2014 Tom Rothamel <pytom@bishoujo.us>
 */
  __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_4)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;

  /* "gl.pxd":1546
 * 
 * 
 * cdef inline gl_check(where):             # <<<<<<<<<<<<<<
 *     cdef GLenum error
 *     error = glGetError()
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  if (__pyx_m) {
    __Pyx_AddTraceback("init renpy.gl.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init renpy.gl.gldraw");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if 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_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%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 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 %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (result) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    /* Make sure tstate is in a consistent state when we XDECREF
       these objects (DECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL)
        value = Py_None; /* Mark as deleted */
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    PyObject* dict = PyModule_GetDict(__pyx_m);
    Py_XINCREF(dict);
    return dict;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
#ifndef PY_WRITE_RESTRICTED /* < Py2.5 */
#define PY_WRITE_RESTRICTED WRITE_RESTRICTED
#endif
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    op->func_weakreflist = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (m->func_weakreflist != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return PyMethod_New(func,
                            type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%zd given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    __Pyx_NAMESTR("cython_function_or_method"), /*tp_name*/
    sizeof(__pyx_CyFunctionObject),   /*tp_basicsize*/
    0,                                  /*tp_itemsize*/
    (destructor) __Pyx_CyFunction_dealloc, /*tp_dealloc*/
    0,                                  /*tp_print*/
    0,                                  /*tp_getattr*/
    0,                                  /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
    0,                                  /*tp_compare*/
#else
    0,                                  /*reserved*/
#endif
    (reprfunc) __Pyx_CyFunction_repr,   /*tp_repr*/
    0,                                  /*tp_as_number*/
    0,                                  /*tp_as_sequence*/
    0,                                  /*tp_as_mapping*/
    0,                                  /*tp_hash*/
    __Pyx_CyFunction_Call,              /*tp_call*/
    0,                                  /*tp_str*/
    0,                                  /*tp_getattro*/
    0,                                  /*tp_setattro*/
    0,                                  /*tp_as_buffer*/
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/
    0,                                  /*tp_doc*/
    (traverseproc) __Pyx_CyFunction_traverse,   /*tp_traverse*/
    (inquiry) __Pyx_CyFunction_clear,   /*tp_clear*/
    0,                                  /*tp_richcompare*/
    offsetof(__pyx_CyFunctionObject, func_weakreflist), /* tp_weaklistoffse */
    0,                                  /*tp_iter*/
    0,                                  /*tp_iternext*/
    __pyx_CyFunction_methods,           /*tp_methods*/
    __pyx_CyFunction_members,           /*tp_members*/
    __pyx_CyFunction_getsets,           /*tp_getset*/
    0,                                  /*tp_base*/
    0,                                  /*tp_dict*/
    __Pyx_CyFunction_descr_get,         /*tp_descr_get*/
    0,                                  /*tp_descr_set*/
    offsetof(__pyx_CyFunctionObject, func_dict),/*tp_dictoffset*/
    0,                                  /*tp_init*/
    0,                                  /*tp_alloc*/
    0,                                  /*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
#if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE)
    0,                                  /*tp_finalize*/
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    if (PyType_Ready(&__pyx_CyFunctionType_type) < 0)
        return -1;
    __pyx_CyFunctionType = &__pyx_CyFunctionType_type;
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

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 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 PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    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);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    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;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED 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);
    }
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    #if PY_VERSION_HEX < 0x02050000
    if (PyClass_Check(type)) {
    #else
    if (PyType_Check(type)) {
    #endif
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        #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) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *args;
        if (!value)
            args = PyTuple_New(0);
        else if (PyTuple_Check(value)) {
            Py_INCREF(value);
            args = value;
        } else
            args = PyTuple_Pack(1, value);
        if (!args)
            goto bad;
        owned_instance = PyEval_CallObject(type, args);
        Py_DECREF(args);
        if (!owned_instance)
            goto bad;
        value = owned_instance;
        if (!PyExceptionInstance_Check(value)) {
            PyErr_Format(PyExc_TypeError,
                         "calling %R should have returned an instance of "
                         "BaseException, not %R",
                         type, Py_TYPE(value));
            goto bad;
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        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:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
#if CYTHON_COMPILING_IN_CPYTHON
#if PY_MAJOR_VERSION >= 3
    if (likely(PyUnicode_Check(n)))
#else
    if (likely(PyString_Check(n)))
#endif
        return __Pyx_PyObject_GetAttrStr(o, n);
#endif
    return PyObject_GetAttr(o, n);
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = __Pyx_GetAttr(o, n);
    if (!r) {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError))
            goto bad;
        PyErr_Clear();
        r = d;
        Py_INCREF(d);
    }
    return r;
bad:
    return NULL;
}

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_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__);
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0; /* try absolute import on failure */
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
    #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:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = __Pyx_PyObject_GetAttrStr(base, __pyx_n_s____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 *qualname, PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;
    if (PyDict_SetItem(dict, __pyx_n_s____module__, modname) < 0)
        return NULL;
    if (PyDict_SetItem(dict, __pyx_n_s____qualname__, qualname) < 0)
        return NULL;
    metaclass = PyDict_GetItem(dict, __pyx_n_s____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 CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_GLint(GLint val) {
    const GLint neg_one = (GLint)-1, const_zero = (GLint)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(GLint) == sizeof(char))  ||
        (sizeof(GLint) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(GLint) == sizeof(int)) ||
               (sizeof(GLint) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(GLint) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(GLint),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_GLenum(GLenum val) {
    const GLenum neg_one = (GLenum)-1, const_zero = (GLenum)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(GLenum) == sizeof(char))  ||
        (sizeof(GLenum) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(GLenum) == sizeof(int)) ||
               (sizeof(GLenum) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(GLenum) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(GLenum),
                                     little, !is_unsigned);
    }
}

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

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
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_MAJOR_VERSION < 3
    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 CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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 {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
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_MAJOR_VERSION < 3
    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 CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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 {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
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_MAJOR_VERSION < 3
    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 CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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 {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
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_MAJOR_VERSION < 3
    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 CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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 {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
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_MAJOR_VERSION < 3
    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 CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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 {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed long)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed long) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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;
    }
}

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
#include "longintrepr.h"
#endif
#endif
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_MAJOR_VERSION < 3
    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 CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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 {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
#if CYTHON_USE_PYLONG_INTERNALS
            if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) {
                switch (Py_SIZE(x)) {
                    case  0: return 0;
                    case  1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                    case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0];
                }
            }
#endif
#endif
            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 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;
}

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;
    py_name = __Pyx_PyIdentifier_FromString(name);
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];
    Py_ssize_t basicsize;
#ifdef Py_LIMITED_API
    PyObject *py_basicsize;
#endif
    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    py_name = __Pyx_PyIdentifier_FromString(class_name);
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
#ifndef Py_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
#else
    py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
    if (!py_basicsize)
        goto bad;
    basicsize = PyLong_AsSsize_t(py_basicsize);
    Py_DECREF(py_basicsize);
    py_basicsize = 0;
    if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
        goto bad;
#endif
    if (!strict && (size_t)basicsize > size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if ((size_t)basicsize != size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

#ifndef __PYX_HAVE_RT_ImportFunction
#define __PYX_HAVE_RT_ImportFunction
static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, funcname);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%s does not export expected C function %s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C function %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), funcname, sig, desc);
        goto bad;
    }
    tmp.p = PyCObject_AsVoidPtr(cobj);}
#endif
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        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,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) 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 = py_line;
    PyTraceBack_Here(py_frame);
bad:
    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;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else /* PY_VERSION_HEX < 0x03030000 */
        if (PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_DATA_SIZE(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
        return PyUnicode_AsUTF8AndSize(o, length);
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */
#endif /* PY_VERSION_HEX < 0x03030000 */
    } else
#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII  || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (r < 0) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  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_MAJOR_VERSION < 3
  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_MAJOR_VERSION < 3
    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)(size_t)val)) {
       if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred())
           PyErr_SetString(PyExc_OverflowError,
                           "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
