/* Generated by Cython 0.15.1 on Sat Nov  9 21:25:11 2013 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

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

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

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

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

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

#endif

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

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

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

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

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

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

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

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

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

#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

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

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

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

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

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__renpy__angle__gldraw
#define __PYX_HAVE_API__renpy__angle__gldraw
#include "stdlib.h"
#include "pygame/pygame.h"
#include "glcompat.h"
#include "anglesupport.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || defined(__INTEL_COMPILER)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

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


/* Type Conversion Predeclarations */

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

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

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

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


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "gldraw.pyx",
  "gldraw.pxd",
  "gl.pxd",
  "render.pxd",
  "gltexture.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid;
struct __pyx_obj_5renpy_7display_6render_Render;
struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half;
struct __pyx_obj_5renpy_7display_6render_Matrix2D;
struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture;
struct __pyx_obj_5renpy_5angle_6gldraw_Environ;
struct __pyx_obj_5renpy_5angle_9gltexture_TextureCore;
struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw;
struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init;
struct __pyx_opt_args_5renpy_7display_6render_6Render_blit;
struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit;

/* "renpy/display/render.pxd":43
 *     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":44
 * 
 *     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;
};

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


/* "renpy/display/render.pxd":9
 *     cpdef tuple transform(Matrix2D self, double x, double y)
 * 
 * cdef class Render:             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint mark, cache_killed
 */
struct __pyx_obj_5renpy_7display_6render_Render {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6render_Render *__pyx_vtab;
  int mark;
  int cache_killed;
  float width;
  float height;
  PyObject *layer_name;
  PyObject *children;
  PyObject *parents;
  PyObject *depends_on_list;
  int operation;
  double operation_complete;
  int operation_alpha;
  PyObject *operation_parameter;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *forward;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *reverse;
  double alpha;
  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/angle/gldraw.pyx":962
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */
struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half {
  PyObject_HEAD
  struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *__pyx_v_draw;
  PyObject *__pyx_v_height;
  PyObject *__pyx_v_reverse;
  PyObject *__pyx_v_what;
  PyObject *__pyx_v_width;
};


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


/* "renpy/angle/gldraw.pyx":891
 *         return 0
 * 
 *     def render_to_texture(self_, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         cdef GLDraw self = self_
 */
struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture {
  PyObject_HEAD
  PyObject *__pyx_v_alpha;
  PyObject *__pyx_v_reverse;
  struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *__pyx_v_self;
  PyObject *__pyx_v_what;
};


/* "renpy/angle/gldraw.pxd":6
 * cimport renpy.display.render as render
 * 
 * cdef class Environ             # <<<<<<<<<<<<<<
 * 
 * cdef class GLDraw:
 */
struct __pyx_obj_5renpy_5angle_6gldraw_Environ {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *__pyx_vtab;
};


/* "gltexture.pxd":7
 * from gldraw cimport Environ
 * 
 * cdef class TextureCore:             # <<<<<<<<<<<<<<
 *     cdef public int width
 *     cdef public int height
 */
struct __pyx_obj_5renpy_5angle_9gltexture_TextureCore {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_5angle_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;
};


/* "renpy/angle/gldraw.pxd":8
 * cdef class Environ
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     cdef bint did_init
 */
struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *__pyx_vtab;
  int did_init;
  struct __pyx_obj_5renpy_5angle_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/angle/gldraw.pyx":346
 *         self.old_fullscreen = None
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does the first-time initialization of OpenGL, deciding
 */
struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init {
  PyObject_HEAD
  PyObject *__pyx_v_extensions;
};



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

struct __pyx_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;


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

struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ {
  void (*blit)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *);
  void (*blend)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, double);
  void (*imageblend)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, double, int);
  void (*set_vertex)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, float *);
  void (*set_texture)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, int, float *);
  void (*set_color)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, float, float, float, float);
  void (*set_clip)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, PyObject *, struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *);
  void (*unset_clip)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *);
  void (*ortho)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, double, double, double, double, double, double);
  void (*viewport)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, int, int, int, int);
};
static struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *__pyx_vtabptr_5renpy_5angle_6gldraw_Environ;


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

struct __pyx_vtabstruct_5renpy_5angle_9gltexture_TextureCore {
  void (*make_ready)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureCore *);
  void (*make_nearest)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureCore *);
  void (*make_linear)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureCore *);
  int (*allocate)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureCore *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_5angle_9gltexture_TextureCore *__pyx_vtabptr_5renpy_5angle_9gltexture_TextureCore;


/* "renpy/angle/gldraw.pyx":79
 * IDENTITY = renpy.display.render.IDENTITY
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, allow_fixed=True):
 */

struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw {
  PyObject *(*set_clip)(struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *, PyObject *, int __pyx_skip_dispatch);
  int (*draw_render_textures)(struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *, PyObject *, int, int __pyx_skip_dispatch);
  int (*draw_transformed)(struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *, PyObject *, PyObject *, double, double, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *__pyx_vtabptr_5renpy_5angle_6gldraw_GLDraw;


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


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

struct __pyx_vtabstruct_5renpy_5angle_9gltexture_TextureGrid {
  void (*make_ready)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, int);
};
static struct __pyx_vtabstruct_5renpy_5angle_9gltexture_TextureGrid *__pyx_vtabptr_5renpy_5angle_9gltexture_TextureGrid;

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */

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

static 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 void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

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

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

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

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

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

static CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void);

#if PY_MAJOR_VERSION >= 3
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(d == Py_None)) {
        __Pyx_RaiseNoneIndexingError();
        return NULL;
    }
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred())
            PyErr_SetObject(PyExc_KeyError, key);
        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*/


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


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

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

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

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


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

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

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

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

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*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, long level); /*proto*/

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

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

#define __pyx_binding_PyCFunctionType_USED 1

typedef struct {
    PyCFunctionObject func;
} __pyx_binding_PyCFunctionType_object;

static PyTypeObject __pyx_binding_PyCFunctionType_type;
static PyTypeObject *__pyx_binding_PyCFunctionType = NULL;

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

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

#if PY_VERSION_HEX < 0x02050000
#ifndef PyAnySet_CheckExact

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    return 0;

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

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

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_GLint(GLint);

#include <string.h>

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

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

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

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

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

static int __Pyx_check_binary_version(void);

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

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

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

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

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

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

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

/* Module declarations from 'renpy.display.render' */
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Matrix2D = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_6render_Render = 0;
static PyObject *(*__pyx_f_5renpy_7display_6render_render)(PyObject *, PyObject *, PyObject *, double, double, int __pyx_skip_dispatch); /*proto*/

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

/* Module declarations from 'pygame' */
__PYX_EXTERN_C DL_IMPORT(int) SDL_BlitSurface(struct SDL_Surface *, struct SDL_Rect *, struct SDL_Surface *, struct SDL_Rect *); /*proto*/

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

/* Module declarations from 'renpy.angle.gltexture' */
static PyTypeObject *__pyx_ptype_5renpy_5angle_9gltexture_TextureCore = 0;
static PyTypeObject *__pyx_ptype_5renpy_5angle_9gltexture_TextureGrid = 0;
static PyObject *(*__pyx_f_5renpy_5angle_9gltexture_blit)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_5renpy_5angle_9gltexture_blend)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, double, struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_5renpy_5angle_9gltexture_imageblend)(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, double, int, struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, int __pyx_skip_dispatch); /*proto*/

/* Module declarations from 'renpy.angle.gldraw' */
static PyTypeObject *__pyx_ptype_5renpy_5angle_6gldraw_Environ = 0;
static PyTypeObject *__pyx_ptype_5renpy_5angle_6gldraw_GLDraw = 0;
static PyTypeObject *__pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct__init = 0;
static PyTypeObject *__pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture = 0;
static PyTypeObject *__pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half = 0;
static int __pyx_v_5renpy_5angle_6gldraw_DISSOLVE;
static int __pyx_v_5renpy_5angle_6gldraw_IMAGEDISSOLVE;
static int __pyx_v_5renpy_5angle_6gldraw_PIXELLATE;
static PyObject *__pyx_v_5renpy_5angle_6gldraw_IDENTITY = 0;
#define __Pyx_MODULE_NAME "renpy.angle.gldraw"
int __pyx_module_is_main_renpy__angle__gldraw = 0;

/* Implementation of 'renpy.angle.gldraw' */
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_sorted;
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[] = "Initializing EGL: %s";
static char __pyx_k_15[] = "Screen sizes: virtual=%r physical=%r";
static char __pyx_k_16[] = "Deallocating textures.";
static char __pyx_k_18[] = "Done deallocating textures.";
static char __pyx_k_20[] = "About to quit GL.";
static char __pyx_k_22[] = "Finished quit GL.";
static char __pyx_k_24[] = "Vendor: %r";
static char __pyx_k_25[] = "Renderer: %r";
static char __pyx_k_26[] = "Version: %r";
static char __pyx_k_27[] = "Display Info: %s";
static char __pyx_k_28[] = "Shaders are blacklisted.";
static char __pyx_k_30[] = "Fixed-function is blacklisted.";
static char __pyx_k_32[] = "GL is totally blacklisted.";
static char __pyx_k_34[] = " ";
static char __pyx_k_36[] = "Extensions:";
static char __pyx_k_38[] = "    %s";
static char __pyx_k_39[] = "renpy.angle.gldraw";
static char __pyx_k_40[] = "Number of texture units: %d";
static char __pyx_k_41[] = "GL_ARB_vertex_shader";
static char __pyx_k_42[] = "GL_ARB_fragment_shader";
static char __pyx_k_43[] = "Using shader environment.";
static char __pyx_k_45[] = "Initializing shader environment failed:";
static char __pyx_k_47[] = "GL_ARB_texture_env_crossbar";
static char __pyx_k_48[] = "GL_ARB_texture_env_combine";
static char __pyx_k_49[] = "Using fixed-function environment (clause 1).";
static char __pyx_k_51[] = "FixedFunctionEnviron";
static char __pyx_k_52[] = "GL_NV_texture_env_combine4";
static char __pyx_k_53[] = "Using fixed-function environment (clause 2).";
static char __pyx_k_55[] = "RENPY_bogus_extension";
static char __pyx_k_56[] = "Using limited environment.";
static char __pyx_k_58[] = "Can't find a workable environment.";
static char __pyx_k_61[] = "Using copy RTT.";
static char __pyx_k_63[] = "GL_OES_framebuffer_object";
static char __pyx_k_64[] = "GL_ARB_framebuffer_object";
static char __pyx_k_65[] = "Using FBO RTT.";
static char __pyx_k_67[] = "Can't find a workable rtt.";
static char __pyx_k_69[] = "Using {0} renderer.";
static char __pyx_k_71[] = "texture_grid_from_surface";
static char __pyx_k_74[] = "draw_render_textures";
static char __pyx_k_75[] = "Unknown drawing type. ";
static char __pyx_k_76[] = "texture_grid_from_drawing";
static char __pyx_k_79[] = "Not implemented.";
static char __pyx_k_82[] = "GL error 0x%X at %s";
static char __pyx_k_83[] = "os.path";
static char __pyx_k_84[] = "\n    This is used to report OpenGL errors.\n    ";
static char __pyx_k_85[] = "\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__w[] = "w";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
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__Info[] = "Info";
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__angle[] = "angle";
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__video[] = "video";
static char __pyx_k__width[] = "width";
static char __pyx_k__write[] = "write";
static char __pyx_k__FboRtt[] = "FboRtt";
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__CopyRtt[] = "CopyRtt";
static char __pyx_k__GLError[] = "GLError";
static char __pyx_k__Surface[] = "Surface";
static char __pyx_k__android[] = "android";
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__reverse[] = "reverse";
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_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__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__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__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__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__IMAGEDISSOLVE[] = "IMAGEDISSOLVE";
static char __pyx_k__ShaderEnviron[] = "ShaderEnviron";
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__LimitedEnviron[] = "LimitedEnviron";
static char __pyx_k__RENPY_GL_VSYNC[] = "RENPY_GL_VSYNC";
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__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__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__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_18;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_24;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_kp_s_27;
static PyObject *__pyx_kp_s_28;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_30;
static PyObject *__pyx_kp_s_32;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_36;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_n_s_39;
static PyObject *__pyx_kp_s_40;
static PyObject *__pyx_n_s_41;
static PyObject *__pyx_n_s_42;
static PyObject *__pyx_kp_s_43;
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_n_s_52;
static PyObject *__pyx_kp_s_53;
static PyObject *__pyx_n_s_55;
static PyObject *__pyx_kp_s_56;
static PyObject *__pyx_kp_s_58;
static PyObject *__pyx_kp_s_61;
static PyObject *__pyx_n_s_63;
static PyObject *__pyx_n_s_64;
static PyObject *__pyx_kp_s_65;
static PyObject *__pyx_kp_s_67;
static PyObject *__pyx_kp_s_69;
static PyObject *__pyx_n_s_71;
static PyObject *__pyx_n_s_74;
static PyObject *__pyx_kp_s_75;
static PyObject *__pyx_n_s_76;
static PyObject *__pyx_kp_s_79;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_82;
static PyObject *__pyx_n_s_83;
static PyObject *__pyx_kp_s_84;
static PyObject *__pyx_kp_s_85;
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__IDENTITY;
static PyObject *__pyx_n_s__IMAGEDISSOLVE;
static PyObject *__pyx_n_s__ImportError;
static PyObject *__pyx_n_s__Info;
static PyObject *__pyx_n_s__LimitedEnviron;
static PyObject *__pyx_n_s__Matrix2D;
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__Rtt;
static PyObject *__pyx_n_s__ShaderEnviron;
static PyObject *__pyx_n_s__Surface;
static PyObject *__pyx_n_s__WeakKeyDictionary;
static PyObject *__pyx_n_s____main__;
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__angle;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__audio;
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_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_enable;
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__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__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_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__use_gles;
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_102;
static PyObject *__pyx_int_255;
static PyObject *__pyx_k_1;
static PyObject *__pyx_k_70;
static PyObject *__pyx_k_72;
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_17;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_21;
static PyObject *__pyx_k_tuple_23;
static PyObject *__pyx_k_tuple_29;
static PyObject *__pyx_k_tuple_31;
static PyObject *__pyx_k_tuple_33;
static PyObject *__pyx_k_tuple_35;
static PyObject *__pyx_k_tuple_37;
static PyObject *__pyx_k_tuple_44;
static PyObject *__pyx_k_tuple_46;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_54;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_59;
static PyObject *__pyx_k_tuple_60;
static PyObject *__pyx_k_tuple_62;
static PyObject *__pyx_k_tuple_66;
static PyObject *__pyx_k_tuple_68;
static PyObject *__pyx_k_tuple_73;
static PyObject *__pyx_k_tuple_77;
static PyObject *__pyx_k_tuple_78;
static PyObject *__pyx_k_tuple_80;
static PyObject *__pyx_k_tuple_81;

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

static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_allow_fixed = 0;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__allow_fixed,0};
  __Pyx_RefNannySetupContext("__init__");
  {
    PyObject* values[1] = {0};
    values[0] = __pyx_k_1;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allow_fixed);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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 = 81; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;

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

  /* "renpy/angle/gldraw.pyx":87
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ = ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)Py_None);

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

  /* "renpy/angle/gldraw.pyx":93
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window = Py_None;

  /* "renpy/angle/gldraw.pyx":96
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size = ((PyObject*)Py_None);

  /* "renpy/angle/gldraw.pyx":99
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size = ((PyObject*)Py_None);

  /* "renpy/angle/gldraw.pyx":102
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible = Py_None;

  /* "renpy/angle/gldraw.pyx":105
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info = ((PyObject *)__pyx_k_tuple_2);

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

  /* "renpy/angle/gldraw.pyx":111
 * 
 *         # The time of the last redraw.
 *         self.last_redraw_time = 0             # <<<<<<<<<<<<<<
 * 
 *         # The time between redraws.
 */
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->last_redraw_time = 0.0;

  /* "renpy/angle/gldraw.pyx":114
 * 
 *         # The time between redraws.
 *         self.redraw_period = .2             # <<<<<<<<<<<<<<
 * 
 *         # Info.
 */
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->redraw_period = .2;

  /* "renpy/angle/gldraw.pyx":117
 * 
 *         # 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 = 117; __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 = 117; __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 = 117; __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 = 117; __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 = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":122
 *             self.info["renderer"] = "gl"
 *         else:
 *             self.info["renderer"] = "angle"             # <<<<<<<<<<<<<<
 * 
 *         # Old value of fullscreen.
 */
  if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__renderer), ((PyObject *)__pyx_n_s__angle)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/angle/gldraw.pyx":125
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen = Py_None;

  /* "renpy/angle/gldraw.pyx":129
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface = Py_None;

  /* "renpy/angle/gldraw.pyx":132
 * 
 *         # 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info = Py_None;

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

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

  /* "renpy/angle/gldraw.pyx":141
 * 
 *         # 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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__android); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __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 = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->always_opaque = __pyx_t_3;

  /* "renpy/angle/gldraw.pyx":144
 * 
 *         # 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 = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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.angle.gldraw.GLDraw.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/angle/gldraw.pyx":146
 *         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_5angle_6gldraw_6GLDraw_1set_mode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_1set_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_pf_5renpy_5angle_6gldraw_6GLDraw_1set_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;
  char *__pyx_v_egl_error;
  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;
  long __pyx_v_opengl;
  long __pyx_v_resizable;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__virtual_size,&__pyx_n_s__physical_size,&__pyx_n_s__fullscreen,0};
  __Pyx_RefNannySetupContext("set_mode");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__virtual_size);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__physical_size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fullscreen);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("set_mode", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "set_mode") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __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 = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_fullscreen);

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

    /* "renpy/angle/gldraw.pyx":156
 * 
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_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 = 156; __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/angle/gldraw.pyx":157
 *         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 = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/angle/gldraw.pyx":159
 *             return False
 * 
 *         if self.did_init:             # <<<<<<<<<<<<<<
 *             self.deinit()
 * 
 */
  if (((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->did_init) {

    /* "renpy/angle/gldraw.pyx":160
 * 
 *         if self.did_init:
 *             self.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if renpy.android:
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__deinit); 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_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __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/angle/gldraw.pyx":162
 *             self.deinit()
 * 
 *         if renpy.android:             # <<<<<<<<<<<<<<
 *             fullscreen = False
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__android); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __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 = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "renpy/angle/gldraw.pyx":163
 * 
 *         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 = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_fullscreen);
    __pyx_v_fullscreen = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

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

    /* "renpy/angle/gldraw.pyx":167
 *         if fullscreen != self.old_fullscreen:
 * 
 *             self.did_init = False             # <<<<<<<<<<<<<<
 * 
 *             if self.old_fullscreen is not None:
 */
    ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->did_init = 0;

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

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

    /* "renpy/angle/gldraw.pyx":172
 *                 pygame.display.quit()
 * 
 *             pygame.display.init()             # <<<<<<<<<<<<<<
 * 
 *             if self.display_info is None:
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); 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_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); 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_GetAttr(__pyx_t_1, __pyx_n_s__init); 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 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":174
 *             pygame.display.init()
 * 
 *             if self.display_info is None:             # <<<<<<<<<<<<<<
 *                 self.display_info = pygame.display.Info()
 * 
 */
    __pyx_t_4 = (((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info == Py_None);
    if (__pyx_t_4) {

      /* "renpy/angle/gldraw.pyx":175
 * 
 *             if self.display_info is None:
 *                 self.display_info = pygame.display.Info()             # <<<<<<<<<<<<<<
 * 
 *             self.old_fullscreen = fullscreen
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __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 = 175; __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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info);
      __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info);
      ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "renpy/angle/gldraw.pyx":177
 *                 self.display_info = pygame.display.Info()
 * 
 *             self.old_fullscreen = fullscreen             # <<<<<<<<<<<<<<
 * 
 *             renpy.display.interface.post_init()
 */
    __Pyx_INCREF(__pyx_v_fullscreen);
    __Pyx_GIVEREF(__pyx_v_fullscreen);
    __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
    ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen = __pyx_v_fullscreen;

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

  /* "renpy/angle/gldraw.pyx":181
 *             renpy.display.interface.post_init()
 * 
 *         renpy.display.log.write("")             # <<<<<<<<<<<<<<
 * 
 *         self.virtual_size = virtual_size
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __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 = 181; __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/angle/gldraw.pyx":183
 *         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 = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_virtual_size);
  __Pyx_GIVEREF(__pyx_v_virtual_size);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size = ((PyObject*)__pyx_v_virtual_size);

  /* "renpy/angle/gldraw.pyx":185
 *         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 (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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 {
    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 = 185; __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_L12_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_L12_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 = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L13_unpacking_done;
    __pyx_L12_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L13_unpacking_done:;
  }
  __pyx_v_vwidth = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vheight = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":186
 * 
 *         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 (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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 {
    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 = 186; __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_L14_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_L14_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 = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L15_unpacking_done;
    __pyx_L14_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L15_unpacking_done:;
  }
  __pyx_v_pwidth = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_pheight = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":187
 *         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 = 187; __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 = 187; __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 = 187; __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/angle/gldraw.pyx":189
 *         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 = 189; __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); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); 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_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_INCREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_v_pwidth);
  __pyx_v_pwidth = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

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

  /* "renpy/angle/gldraw.pyx":192
 *         pheight = max(vheight / 2, pheight)
 * 
 *         if renpy.android:             # <<<<<<<<<<<<<<
 *             pheight = self.display_info.current_h
 *             pwidth = self.display_info.current_w
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__android); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __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 = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "renpy/angle/gldraw.pyx":193
 * 
 *         if renpy.android:
 *             pheight = self.display_info.current_h             # <<<<<<<<<<<<<<
 *             pwidth = self.display_info.current_w
 *         else:
 */
    __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_h); 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_v_pheight);
    __pyx_v_pheight = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/angle/gldraw.pyx":194
 *         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_5 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_w); 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_v_pwidth);
    __pyx_v_pwidth = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L16;
  }
  /*else*/ {

    /* "renpy/angle/gldraw.pyx":196
 *             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_5 = __pyx_v_pheight;
    __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_h); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_102); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_4) {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_1 = __pyx_t_5;
    } else {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_1 = __pyx_t_2;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_pheight);
    __pyx_v_pheight = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":197
 *         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_5 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_w); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_int_102); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __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_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_pwidth);
    __pyx_v_pwidth = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

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

      /* "renpy/angle/gldraw.pyx":201
 *             # 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_5 = __pyx_v_pwidth;
      __pyx_t_1 = PyNumber_Multiply(__pyx_v_pheight, __pyx_v_virtual_ar); 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_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_4) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_2 = __pyx_t_5;
      } else {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_2 = __pyx_t_1;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_2;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_INCREF(__pyx_v_pheight);
      __pyx_t_2 = __pyx_v_pheight;
      __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_pwidth, __pyx_v_virtual_ar); 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_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_4) {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_7 = __pyx_t_2;
      } else {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = __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_7;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_pwidth);
      __pyx_v_pwidth = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_pheight);
      __pyx_v_pheight = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L17;
    }
    __pyx_L17:;
  }
  __pyx_L16:;

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

  /* "renpy/angle/gldraw.pyx":204
 * 
 *         pwidth = int(pwidth)
 *         pheight = int(pheight)             # <<<<<<<<<<<<<<
 * 
 *         pwidth = max(pwidth, 256)
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_v_pheight);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_pheight);
  __Pyx_GIVEREF(__pyx_v_pheight);
  __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 = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_pheight);
  __pyx_v_pheight = __pyx_t_2;
  __pyx_t_2 = 0;

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

  /* "renpy/angle/gldraw.pyx":207
 * 
 *         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_1 = PyInt_FromLong(__pyx_t_9); 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_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __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 = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_2 = __pyx_t_7;
    __pyx_t_7 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_2 = __pyx_t_5;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_pheight);
  __pyx_v_pheight = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":210
 * 
 *         # Handle swap control.
 *         vsync = int(os.environ.get("RENPY_GL_VSYNC", "1"))             # <<<<<<<<<<<<<<
 * 
 *         if ANGLE:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__environ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__get); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __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 = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 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_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_vsync = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":213
 * 
 *         if ANGLE:
 *             opengl = 0             # <<<<<<<<<<<<<<
 *             resizable = 0
 *         elif renpy.android:
 */
  __pyx_v_opengl = 0;

  /* "renpy/angle/gldraw.pyx":214
 *         if ANGLE:
 *             opengl = 0
 *             resizable = 0             # <<<<<<<<<<<<<<
 *         elif renpy.android:
 *             opengl = pygame.OPENGL
 */
  __pyx_v_resizable = 0;

  /* "renpy/angle/gldraw.pyx":228
 *                 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/angle/gldraw.pyx":229
 * 
 *         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 = 229; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
      if (__pyx_t_4) {

        /* "renpy/angle/gldraw.pyx":230
 *         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_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L18_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_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "renpy/angle/gldraw.pyx":231
 *             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_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__set_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__FULLSCREEN); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyInt_FromLong(__pyx_v_opengl); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_1 = PyNumber_Or(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__DOUBLEBUF); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyNumber_Or(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
        __Pyx_INCREF(((PyObject *)__pyx_k_tuple_10));
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_k_tuple_10));
        __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
        __Pyx_GIVEREF(__pyx_t_2);
        __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window);
        __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window);
        ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window = __pyx_t_2;
        __pyx_t_2 = 0;
        goto __pyx_L26;
      }
      /*else*/ {

        /* "renpy/angle/gldraw.pyx":233
 *                 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_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "renpy/angle/gldraw.pyx":234
 *             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_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__set_mode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_7));
        __Pyx_INCREF(__pyx_v_pwidth);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_pwidth);
        __Pyx_GIVEREF(__pyx_v_pwidth);
        __Pyx_INCREF(__pyx_v_pheight);
        PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_pheight);
        __Pyx_GIVEREF(__pyx_v_pheight);
        __pyx_t_5 = PyInt_FromLong((__pyx_v_resizable | __pyx_v_opengl)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__DOUBLEBUF); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyNumber_Or(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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 = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_8));
        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_7));
        __Pyx_GIVEREF(((PyObject *)__pyx_t_7));
        PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_7 = 0;
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window);
        __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window);
        ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window = __pyx_t_1;
        __pyx_t_1 = 0;
      }
      __pyx_L26:;
    }
    __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_L25_try_end;
    __pyx_L18_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":236
 *                 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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__error); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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.angle.gldraw.GLDraw.set_mode", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_1);
      __pyx_v_e = __pyx_t_1;

      /* "renpy/angle/gldraw.pyx":237
 * 
 *         except pygame.error, e:
 *             renpy.display.log.write("Could not get pygame screen: %r", e)             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__write); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_13));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
      __Pyx_INCREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      __pyx_t_14 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

      /* "renpy/angle/gldraw.pyx":238
 *         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 = 238; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_r = __pyx_t_14;
      __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L21_except_return;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L19_exception_handled;
    }
    __pyx_L20_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_L21_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_L19_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_L25_try_end:;
  }

  /* "renpy/angle/gldraw.pyx":244
 * 
 *             # This ensures the display is shown.
 *             pygame.display.flip()             # <<<<<<<<<<<<<<
 * 
 *             egl_error = egl_init(vsync)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__flip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __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 = 244; __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/angle/gldraw.pyx":246
 *             pygame.display.flip()
 * 
 *             egl_error = egl_init(vsync)             # <<<<<<<<<<<<<<
 * 
 *             if egl_error is not NULL:
 */
  __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_vsync); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_egl_error = egl_init(__pyx_t_13);

  /* "renpy/angle/gldraw.pyx":248
 *             egl_error = egl_init(vsync)
 * 
 *             if egl_error is not NULL:             # <<<<<<<<<<<<<<
 *                 renpy.display.log.write("Initializing EGL: %s" % egl_error)
 *                 return False
 */
  __pyx_t_4 = (__pyx_v_egl_error != NULL);
  if (__pyx_t_4) {

    /* "renpy/angle/gldraw.pyx":249
 * 
 *             if egl_error is not NULL:
 *                 renpy.display.log.write("Initializing EGL: %s" % egl_error)             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyBytes_FromString(__pyx_v_egl_error); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_14), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_8));
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_8));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
    __pyx_t_8 = 0;
    __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "renpy/angle/gldraw.pyx":250
 *             if egl_error is not NULL:
 *                 renpy.display.log.write("Initializing EGL: %s" % egl_error)
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         # Get the size of the created screen.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_8 = __Pyx_PyBool_FromLong(0); 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);
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    goto __pyx_L0;
    goto __pyx_L29;
  }
  __pyx_L29:;

  /* "renpy/angle/gldraw.pyx":253
 * 
 *         # Get the size of the created screen.
 *         pwidth, pheight = self.window.get_size()             # <<<<<<<<<<<<<<
 *         self.physical_size = (pwidth, pheight)
 * 
 */
  __pyx_t_8 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->window, __pyx_n_s__get_size); 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_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_2 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_8);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_14 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_6 = Py_TYPE(__pyx_t_14)->tp_iternext;
    index = 0; __pyx_t_8 = __pyx_t_6(__pyx_t_14); if (unlikely(!__pyx_t_8)) goto __pyx_L30_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_8);
    index = 1; __pyx_t_2 = __pyx_t_6(__pyx_t_14); if (unlikely(!__pyx_t_2)) goto __pyx_L30_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_14), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    goto __pyx_L31_unpacking_done;
    __pyx_L30_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L31_unpacking_done:;
  }
  __Pyx_DECREF(__pyx_v_pwidth);
  __pyx_v_pwidth = __pyx_t_8;
  __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_v_pheight);
  __pyx_v_pheight = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":254
 *         # 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_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_pwidth);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pwidth);
  __Pyx_GIVEREF(__pyx_v_pwidth);
  __Pyx_INCREF(__pyx_v_pheight);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_pheight);
  __Pyx_GIVEREF(__pyx_v_pheight);
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":256
 *         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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
  __pyx_t_8 = 0;
  __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

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

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

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

    /* "renpy/angle/gldraw.pyx":264
 *         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/angle/gldraw.pyx":265
 *             x_padding = physical_ar * vheight - vwidth
 *             y_padding = 0
 *             px_padding = x_padding * pheight / vheight             # <<<<<<<<<<<<<<
 *             py_padding = 0
 *         else:
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_x_padding, __pyx_v_pheight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_vheight); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_px_padding = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "renpy/angle/gldraw.pyx":266
 *             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_L32;
  }
  /*else*/ {

    /* "renpy/angle/gldraw.pyx":268
 *             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/angle/gldraw.pyx":269
 *         else:
 *             x_padding = 0
 *             y_padding = ( 1.0 / physical_ar ) * vwidth - vheight             # <<<<<<<<<<<<<<
 *             px_padding = 0
 *             py_padding = y_padding * pwidth / vwidth
 */
    __pyx_t_8 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_8, __pyx_v_physical_ar); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyNumber_Multiply(__pyx_t_1, __pyx_v_vwidth); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_Subtract(__pyx_t_8, __pyx_v_vheight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_v_y_padding = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":270
 *             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/angle/gldraw.pyx":271
 *             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_1 = PyNumber_Multiply(__pyx_v_y_padding, __pyx_v_pwidth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_8 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_vwidth); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_v_py_padding = __pyx_t_8;
    __pyx_t_8 = 0;
  }
  __pyx_L32:;

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

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

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

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

  /* "renpy/angle/gldraw.pyx":277
 *         # 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_7));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box = __pyx_t_7;
  __pyx_t_7 = 0;

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

  /* "renpy/angle/gldraw.pyx":288
 *         self.physical_box = (
 *             int(px_padding / 2),
 *             int(py_padding / 2),             # <<<<<<<<<<<<<<
 *             pwidth - int(px_padding),
 *             pheight - int(py_padding),
 */
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_py_padding, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  PyTuple_SET_ITEM(__pyx_t_8, 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_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;

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

  /* "renpy/angle/gldraw.pyx":290
 *             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 = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0;
  __pyx_t_14 = PyNumber_Subtract(__pyx_v_pheight, __pyx_t_2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_14);
  __Pyx_GIVEREF(__pyx_t_14);
  __pyx_t_7 = 0;
  __pyx_t_1 = 0;
  __pyx_t_8 = 0;
  __pyx_t_14 = 0;

  /* "renpy/angle/gldraw.pyx":286
 *         # 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_2));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":293
 *             )
 * 
 *         if not self.did_init:             # <<<<<<<<<<<<<<
 *             if not self.init():
 *                 return False
 */
  __pyx_t_4 = (!((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->did_init);
  if (__pyx_t_4) {

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

      /* "renpy/angle/gldraw.pyx":295
 *         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 = 295; __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_L34;
    }
    __pyx_L34:;
    goto __pyx_L33;
  }
  __pyx_L33:;

  /* "renpy/angle/gldraw.pyx":297
 *                 return False
 * 
 *         self.did_init = True             # <<<<<<<<<<<<<<
 * 
 *         # Set some default settings.
 */
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->did_init = 1;

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

  /* "renpy/angle/gldraw.pyx":301
 *         # 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/angle/gldraw.pyx":304
 * 
 *         # Prepare a mouse display.
 *         self.mouse_old_visible = None             # <<<<<<<<<<<<<<
 * 
 *         self.environ.init()
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible = Py_None;

  /* "renpy/angle/gldraw.pyx":306
 *         self.mouse_old_visible = None
 * 
 *         self.environ.init()             # <<<<<<<<<<<<<<
 *         self.rtt.init()
 * 
 */
  __pyx_t_14 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ), __pyx_n_s__init); 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_t_2 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

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

  /* "renpy/angle/gldraw.pyx":311
 *         gl_check("set_mode")
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def deinit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __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_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.angle.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_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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_2deinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_2deinit[] = "\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_pf_5renpy_5angle_6gldraw_6GLDraw_2deinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("deinit");

  /* "renpy/angle/gldraw.pyx":319
 *         """
 * 
 *         renpy.display.interface.kill_textures()             # <<<<<<<<<<<<<<
 * 
 *         self.texture_cache.clear()
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__interface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__kill_textures); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __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 = 319; __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/angle/gldraw.pyx":321
 *         renpy.display.interface.kill_textures()
 * 
 *         self.texture_cache.clear()             # <<<<<<<<<<<<<<
 * 
 *         gltexture.dealloc_textures()
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __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 = 321; __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/angle/gldraw.pyx":323
 *         self.texture_cache.clear()
 * 
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 * 
 *         if self.rtt:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); 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_GetAttr(__pyx_t_2, __pyx_n_s__dealloc_textures); 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_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":325
 *         gltexture.dealloc_textures()
 * 
 *         if self.rtt:             # <<<<<<<<<<<<<<
 *             self.rtt.deinit()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt); 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/angle/gldraw.pyx":326
 * 
 *         if self.rtt:
 *             self.rtt.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if self.environ:
 */
    __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt, __pyx_n_s__deinit); 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_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

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

    /* "renpy/angle/gldraw.pyx":329
 * 
 *         if self.environ:
 *             self.environ.deinit()             # <<<<<<<<<<<<<<
 * 
 *     def quit(self):
 */
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ), __pyx_n_s__deinit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __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 = 329; __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:;

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

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

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

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

    /* "renpy/angle/gldraw.pyx":334
 * 
 *         if not self.old_fullscreen:
 *             renpy.display.gl_size = self.physical_size             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Deallocating textures.")
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s__gl_size, ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "renpy/angle/gldraw.pyx":336
 *             renpy.display.gl_size = self.physical_size
 * 
 *         renpy.display.log.write("Deallocating textures.")             # <<<<<<<<<<<<<<
 *         gltexture.dealloc_textures()
 *         renpy.display.log.write("Done deallocating textures.")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/angle/gldraw.pyx":337
 * 
 *         renpy.display.log.write("Deallocating textures.")
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Done deallocating textures.")
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__dealloc_textures); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/angle/gldraw.pyx":338
 *         renpy.display.log.write("Deallocating textures.")
 *         gltexture.dealloc_textures()
 *         renpy.display.log.write("Done deallocating textures.")             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("About to quit GL.")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/angle/gldraw.pyx":340
 *         renpy.display.log.write("Done deallocating textures.")
 * 
 *         renpy.display.log.write("About to quit GL.")             # <<<<<<<<<<<<<<
 *         pygame.display.quit()
 *         renpy.display.log.write("Finished quit GL.")
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "renpy/angle/gldraw.pyx":341
 * 
 *         renpy.display.log.write("About to quit GL.")
 *         pygame.display.quit()             # <<<<<<<<<<<<<<
 *         renpy.display.log.write("Finished quit GL.")
 * 
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__quit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":342
 *         renpy.display.log.write("About to quit GL.")
 *         pygame.display.quit()
 *         renpy.display.log.write("Finished quit GL.")             # <<<<<<<<<<<<<<
 * 
 *         self.old_fullscreen = None
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":344
 *         renpy.display.log.write("Finished quit GL.")
 * 
 *         self.old_fullscreen = None             # <<<<<<<<<<<<<<
 * 
 *     def init(self):
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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_AddTraceback("renpy.angle.gldraw.GLDraw.quit", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/angle/gldraw.pyx":408
 *             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_5angle_6gldraw_4init_use_subsystem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_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_5angle_6gldraw_4init_use_subsystem = {__Pyx_NAMESTR("use_subsystem"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_4init_use_subsystem, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_4init_use_subsystem)};
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_4init_use_subsystem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *__pyx_cur_scope;
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *__pyx_outer_scope;
  PyObject *__pyx_v_module = 0;
  PyObject *__pyx_v_envvar = 0;
  PyObject *__pyx_v_envval = 0;
  PyObject *__pyx_v_req_ext = 0;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_i = 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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__module,&__pyx_n_s__envvar,&__pyx_n_s__envval,0};
  __Pyx_RefNannySetupContext("use_subsystem");
  __pyx_outer_scope = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *)__pyx_self;
  __pyx_cur_scope = __pyx_outer_scope;
  __pyx_self = __pyx_self;
  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);
  }
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__module);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__envvar);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("use_subsystem", 0, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__envval);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("use_subsystem", 0, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 3) ? PyTuple_GET_SIZE(__pyx_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 = 408; __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 = 408; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_req_ext); __pyx_v_req_ext = 0;
  __Pyx_AddTraceback("renpy.angle.gldraw.init.use_subsystem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "renpy/angle/gldraw.pyx":418
 *             """
 * 
 *             if module is None:             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  __pyx_t_1 = (__pyx_v_module == Py_None);
  if (__pyx_t_1) {

    /* "renpy/angle/gldraw.pyx":419
 * 
 *             if module is None:
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *             value = os.environ.get(envvar, "")
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __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_L6;
  }
  __pyx_L6:;

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

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

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

      /* "renpy/angle/gldraw.pyx":424
 *             if value:
 *                 if value == envval:
 *                     return True             # <<<<<<<<<<<<<<
 *                 else:
 *                     return False
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __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_L8;
    }
    /*else*/ {

      /* "renpy/angle/gldraw.pyx":426
 *                     return True
 *                 else:
 *                     return False             # <<<<<<<<<<<<<<
 * 
 *             for i in req_ext:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __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_L8:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "renpy/angle/gldraw.pyx":428
 *                     return False
 * 
 *             for i in req_ext:             # <<<<<<<<<<<<<<
 *                 if i not in extensions:
 *                     return False
 */
  if (unlikely(((PyObject *)__pyx_v_req_ext) == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_4 = ((PyObject *)__pyx_v_req_ext); __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  for (;;) {
    if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_v_extensions)) { __Pyx_RaiseClosureNameError("extensions"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_1 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_cur_scope->__pyx_v_extensions, __pyx_v_i))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/angle/gldraw.pyx":429
 * 
 *             for i in req_ext:
 *                 if i not in extensions:             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
    if (__pyx_t_1) {

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

  /* "renpy/angle/gldraw.pyx":432
 *                     return False
 * 
 *             return True             # <<<<<<<<<<<<<<
 * 
 *         # Count the number of texture units.
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.angle.gldraw.init.use_subsystem", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_req_ext);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_4init[] = "\n        This does the first-time initialization of OpenGL, deciding\n        which subsystems to use.\n        ";
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *__pyx_cur_scope;
  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;
  PyObject *__pyx_v_e = 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;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  int __pyx_t_19;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init");
  __pyx_cur_scope = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *)__pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct__init->tp_new(__pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct__init, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);

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

  /* "renpy/angle/gldraw.pyx":363
 *         # 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/angle/gldraw.pyx":365
 *         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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyBytes_FromString(((char *)glGetString(GL_VENDOR))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __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 = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_24));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
  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 = 365; __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(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":366
 * 
 *         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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyBytes_FromString(__pyx_v_renderer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_25));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((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 = 366; __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;

  /* "renpy/angle/gldraw.pyx":367
 *         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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_26));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((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 = 367; __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(__pyx_t_1); __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":368
 *         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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_27));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
  __Pyx_INCREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  __Pyx_GIVEREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  __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 = 368; __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/angle/gldraw.pyx":371
 * 
 * 
 *         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 = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_allow_shader = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":372
 * 
 *         allow_shader = True
 *         allow_fixed = self.allow_fixed             # <<<<<<<<<<<<<<
 * 
 *         for r, v, allow_shader_, allow_fixed_ in glblacklist.BLACKLIST:
 */
  __pyx_t_2 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->allow_fixed); 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_v_allow_fixed = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":374
 *         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_GetName(__pyx_m, __pyx_n_s__glblacklist); 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_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__BLACKLIST); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
          if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
          if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_8 = PyList_GET_ITEM(sequence, 3); 
      }
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = Py_TYPE(__pyx_t_9)->tp_iternext;
      index = 0; __pyx_t_3 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_6 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_6)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 2; __pyx_t_7 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      index = 3; __pyx_t_8 = __pyx_t_10(__pyx_t_9); if (unlikely(!__pyx_t_8)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L8_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_r);
    __pyx_v_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_v);
    __pyx_v_v = __pyx_t_6;
    __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_v_allow_shader_);
    __pyx_v_allow_shader_ = __pyx_t_7;
    __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_v_allow_fixed_);
    __pyx_v_allow_fixed_ = __pyx_t_8;
    __pyx_t_8 = 0;

    /* "renpy/angle/gldraw.pyx":375
 * 
 *         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_1 = PyBytes_FromString(__pyx_v_renderer); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    __pyx_t_11 = ((PySequence_Contains(((PyObject *)__pyx_t_1), __pyx_v_r))); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    if (__pyx_t_11) {
      __pyx_t_1 = PyBytes_FromString(__pyx_v_version); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      __pyx_t_12 = ((PySequence_Contains(((PyObject *)__pyx_t_1), __pyx_v_v))); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_13 = __pyx_t_12;
    } else {
      __pyx_t_13 = __pyx_t_11;
    }
    if (__pyx_t_13) {

      /* "renpy/angle/gldraw.pyx":376
 *         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 = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_13) {
        __Pyx_INCREF(__pyx_v_allow_shader_);
        __pyx_t_1 = __pyx_v_allow_shader_;
      } else {
        __Pyx_INCREF(__pyx_v_allow_shader);
        __pyx_t_1 = __pyx_v_allow_shader;
      }
      __Pyx_DECREF(__pyx_v_allow_shader);
      __pyx_v_allow_shader = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "renpy/angle/gldraw.pyx":377
 *             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 = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (__pyx_t_13) {
        __Pyx_INCREF(__pyx_v_allow_fixed_);
        __pyx_t_1 = __pyx_v_allow_fixed_;
      } else {
        __Pyx_INCREF(__pyx_v_allow_fixed);
        __pyx_t_1 = __pyx_v_allow_fixed;
      }
      __Pyx_DECREF(__pyx_v_allow_fixed);
      __pyx_v_allow_fixed = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "renpy/angle/gldraw.pyx":378
 *                 allow_shader = allow_shader and allow_shader_
 *                 allow_fixed = allow_fixed and allow_fixed_
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         if not allow_shader:
 */
      goto __pyx_L6_break;
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __pyx_L6_break:;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":380
 *                 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 = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = (!__pyx_t_13);
  if (__pyx_t_11) {

    /* "renpy/angle/gldraw.pyx":381
 * 
 *         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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __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_29), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __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_L10;
  }
  __pyx_L10:;

  /* "renpy/angle/gldraw.pyx":382
 *         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_11 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_13 = (!__pyx_t_11);
  if (__pyx_t_13) {

    /* "renpy/angle/gldraw.pyx":383
 *             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_GetName(__pyx_m, __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_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __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_31), NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "renpy/angle/gldraw.pyx":385
 *             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 = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = (!__pyx_t_13);
  if (__pyx_t_11) {
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_v_allow_fixed); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = (!__pyx_t_13);
    __pyx_t_13 = __pyx_t_12;
  } else {
    __pyx_t_13 = __pyx_t_11;
  }
  if (__pyx_t_13) {

    /* "renpy/angle/gldraw.pyx":386
 * 
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); 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_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); 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_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __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_33), NULL); 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_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "renpy/angle/gldraw.pyx":387
 *         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 = 387; __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_L12;
  }
  __pyx_L12:;

  /* "renpy/angle/gldraw.pyx":390
 * 
 *         if ANGLE:
 *             gltexture.use_gles()             # <<<<<<<<<<<<<<
 * 
 *         elif renpy.android:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__use_gles); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_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 = 390; __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/angle/gldraw.pyx":400
 *             gltexture.use_gl()
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)             # <<<<<<<<<<<<<<
 *         extensions = set(extensions_string.split(" "))
 * 
 */
  __pyx_v_extensions_string = ((char *)glGetString(GL_EXTENSIONS));

  /* "renpy/angle/gldraw.pyx":401
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 *         extensions = set(extensions_string.split(" "))             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Extensions:")
 */
  __pyx_t_2 = PyBytes_FromString(__pyx_v_extensions_string); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_t_2), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_cur_scope->__pyx_v_extensions = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":403
 *         extensions = set(extensions_string.split(" "))
 * 
 *         renpy.display.log.write("Extensions:")             # <<<<<<<<<<<<<<
 * 
 *         for i in sorted(extensions):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __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_37), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __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/angle/gldraw.pyx":405
 *         renpy.display.log.write("Extensions:")
 * 
 *         for i in sorted(extensions):             # <<<<<<<<<<<<<<
 *             renpy.display.log.write("    %s", i)
 * 
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_extensions);
  __pyx_t_1 = PyObject_Call(__pyx_builtin_sorted, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) {
    __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    if (PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else if (PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++;
    } else {
      __pyx_t_1 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_1;
    __pyx_t_1 = 0;

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

  /* "renpy/angle/gldraw.pyx":408
 *             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_2 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_5angle_6gldraw_4init_use_subsystem, ((PyObject*)__pyx_cur_scope), __pyx_n_s_39); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_v_use_subsystem);
  __pyx_v_use_subsystem = __pyx_t_2;
  __pyx_t_2 = 0;

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

  /* "renpy/angle/gldraw.pyx":436
 *         # 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/angle/gldraw.pyx":438
 *         glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units)
 * 
 *         renpy.display.log.write("Number of texture units: %d", texture_units)             # <<<<<<<<<<<<<<
 * 
 *         # Pick a texture environment subsystem.
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_to_py_GLint(__pyx_v_texture_units); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_40));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_40));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_40));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

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

        /* "renpy/angle/gldraw.pyx":443
 * 
 *         if ANGLE or renpy.android or (allow_shader and use_subsystem(
 *             glenviron_shader,             # <<<<<<<<<<<<<<
 *             "RENPY_GL_ENVIRON",
 *             "shader",
 */
        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_shader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__pyx_t_2));
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __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__shader));
        PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_n_s__shader));
        __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shader));
        __Pyx_INCREF(((PyObject *)__pyx_n_s_41));
        PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s_41));
        __Pyx_GIVEREF(((PyObject *)__pyx_n_s_41));
        __Pyx_INCREF(((PyObject *)__pyx_n_s_42));
        PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_n_s_42));
        __Pyx_GIVEREF(((PyObject *)__pyx_n_s_42));
        __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
        __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_15 = __pyx_t_14;
      } else {
        __pyx_t_15 = __pyx_t_12;
      }
      __pyx_t_12 = __pyx_t_15;
    } else {
      __pyx_t_12 = __pyx_t_11;
    }
    __pyx_t_11 = __pyx_t_12;
  } else {
    __pyx_t_11 = __pyx_t_13;
  }
  if (__pyx_t_11) {

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

        /* "renpy/angle/gldraw.pyx":450
 * 
 *             try:
 *                 renpy.display.log.write("Using shader environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 */
        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L16_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_44), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L16_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/angle/gldraw.pyx":451
 *             try:
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "shader"
 *                 self.environ.init()
 */
        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_shader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ShaderEnviron); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L16_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 = 451; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_5angle_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L16_error;}
        __Pyx_GIVEREF(__pyx_t_1);
        __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ);
        __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
        ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ = ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)__pyx_t_1);
        __pyx_t_1 = 0;

        /* "renpy/angle/gldraw.pyx":452
 *                 renpy.display.log.write("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
        if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__shader)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L16_error;}

        /* "renpy/angle/gldraw.pyx":453
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 *                 self.environ.init()             # <<<<<<<<<<<<<<
 * 
 *             except Exception, e:
 */
        __pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ), __pyx_n_s__init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L16_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 = 453; __pyx_clineno = __LINE__; goto __pyx_L16_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_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
      __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
      __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
      goto __pyx_L23_try_end;
      __pyx_L16_error:;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

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

        /* "renpy/angle/gldraw.pyx":456
 * 
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")             # <<<<<<<<<<<<<<
 *                 renpy.display.log.exception()
 *                 self.environ = None
 */
        __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__display); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__write); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_46), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

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

        /* "renpy/angle/gldraw.pyx":458
 *                 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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ);
        __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
        ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ = ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)Py_None);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L17_exception_handled;
      }
      __pyx_L18_except_error:;
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      goto __pyx_L1_error;
      __pyx_L17_exception_handled:;
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_XGIVEREF(__pyx_t_18);
      __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      __pyx_L23_try_end:;
    }
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "renpy/angle/gldraw.pyx":460
 *                 self.environ = None
 * 
 *         if self.environ is None:             # <<<<<<<<<<<<<<
 * 
 *             if allow_fixed and use_subsystem(
 */
  __pyx_t_11 = (((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ) == Py_None);
  if (__pyx_t_11) {

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

      /* "renpy/angle/gldraw.pyx":463
 * 
 *             if allow_fixed and use_subsystem(
 *                 glenviron_fixed,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "fixed",
 */
      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyTuple_New(5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      PyTuple_SET_ITEM(__pyx_t_1, 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_1, 2, ((PyObject *)__pyx_n_s__fixed));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fixed));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
      PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s_47));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_48));
      PyTuple_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s_48));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_48));
      __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
      __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_12 = __pyx_t_13;
    } else {
      __pyx_t_12 = __pyx_t_11;
    }
    if (__pyx_t_12) {

      /* "renpy/angle/gldraw.pyx":469
 *                 "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_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_50), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "renpy/angle/gldraw.pyx":470
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()
 */
      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s_51); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5renpy_5angle_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
      ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ = ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/angle/gldraw.pyx":471
 *                 renpy.display.log.write("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__fixed)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

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

      /* "renpy/angle/gldraw.pyx":475
 * 
 *             elif allow_fixed and use_subsystem(
 *                 glenviron_fixed,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "fixed",
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_7));
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
      PyTuple_SET_ITEM(__pyx_t_7, 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_7, 2, ((PyObject *)__pyx_n_s__fixed));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fixed));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_52));
      PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_52));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_52));
      __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
      __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13 = __pyx_t_11;
    } else {
      __pyx_t_13 = __pyx_t_12;
    }
    if (__pyx_t_13) {

      /* "renpy/angle/gldraw.pyx":480
 *                 "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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_54), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "renpy/angle/gldraw.pyx":481
 * 
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "fixed"
 *                 self.environ.init()
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_51); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5renpy_5angle_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
      ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ = ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)__pyx_t_1);
      __pyx_t_1 = 0;

      /* "renpy/angle/gldraw.pyx":482
 *                 renpy.display.log.write("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__fixed)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

    /* "renpy/angle/gldraw.pyx":486
 * 
 *             elif use_subsystem(
 *                 glenviron_limited,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "limited",
 */
    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_limited); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_1));
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_ENVIRON));
    PyTuple_SET_ITEM(__pyx_t_1, 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_1, 2, ((PyObject *)__pyx_n_s__limited));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limited));
    __Pyx_INCREF(((PyObject *)__pyx_n_s_55));
    PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s_55));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_55));
    __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_13) {

      /* "renpy/angle/gldraw.pyx":491
 *                 "RENPY_bogus_extension"):
 * 
 *                 renpy.display.log.write("Using limited environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 */
      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_57), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "renpy/angle/gldraw.pyx":492
 * 
 *                 renpy.display.log.write("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "limited"
 *                 self.environ.init()
 */
      __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_limited); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__LimitedEnviron); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5renpy_5angle_6gldraw_Environ))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GIVEREF(__pyx_t_7);
      __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ);
      __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
      ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ = ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)__pyx_t_7);
      __pyx_t_7 = 0;

      /* "renpy/angle/gldraw.pyx":493
 *                 renpy.display.log.write("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"             # <<<<<<<<<<<<<<
 *                 self.environ.init()
 * 
 */
      if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__limited)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

      /* "renpy/angle/gldraw.pyx":497
 * 
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_59), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "renpy/angle/gldraw.pyx":498
 *             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_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __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_L27:;
    goto __pyx_L26;
  }
  __pyx_L26:;

  /* "renpy/angle/gldraw.pyx":502
 *         # 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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glrtt_copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_13) {
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__environ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_60), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyString_Equals(__pyx_t_7, ((PyObject *)__pyx_n_s__copy), Py_EQ); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_11 = __pyx_t_12;
  } else {
    __pyx_t_11 = __pyx_t_13;
  }
  if (__pyx_t_11) {

    /* "renpy/angle/gldraw.pyx":503
 * 
 *         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_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_62), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "renpy/angle/gldraw.pyx":504
 *         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_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__glrtt_copy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__CopyRtt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_GIVEREF(__pyx_t_7);
    __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt = __pyx_t_7;
    __pyx_t_7 = 0;

    /* "renpy/angle/gldraw.pyx":505
 *             renpy.display.log.write("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"             # <<<<<<<<<<<<<<
 *             self.rtt.init()
 * 
 */
    if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__rtt), ((PyObject *)__pyx_n_s__copy)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "renpy/angle/gldraw.pyx":509
 * 
 *         elif (use_subsystem(
 *                 glrtt_fbo,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_RTT",
 *                 "fbo",
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glrtt_fbo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
  PyTuple_SET_ITEM(__pyx_t_7, 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_7, 2, ((PyObject *)__pyx_n_s__fbo));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbo));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_63));
  PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_63));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_63));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_11) {

    /* "renpy/angle/gldraw.pyx":514
 *                 "GL_OES_framebuffer_object") or
 *             use_subsystem(
 *                 glrtt_fbo,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_RTT",
 *                 "fbo",
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glrtt_fbo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_7));
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
    PyTuple_SET_ITEM(__pyx_t_7, 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_7, 2, ((PyObject *)__pyx_n_s__fbo));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fbo));
    __Pyx_INCREF(((PyObject *)__pyx_n_s_64));
    PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_64));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_64));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_use_subsystem, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
    __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __pyx_t_13;
  } else {
    __pyx_t_12 = __pyx_t_11;
  }
  if (__pyx_t_12) {

    /* "renpy/angle/gldraw.pyx":519
 *                 "GL_ARB_framebuffer_object")):
 * 
 *             renpy.display.log.write("Using FBO RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_k_tuple_66), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":520
 * 
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()             # <<<<<<<<<<<<<<
 *             self.info["rtt"] = "fbo"
 *             self.rtt.init()
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glrtt_fbo); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__FboRtt); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GIVEREF(__pyx_t_1);
    __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":521
 *             renpy.display.log.write("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"             # <<<<<<<<<<<<<<
 *             self.rtt.init()
 * 
 */
    if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__rtt), ((PyObject *)__pyx_n_s__fbo)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

    /* "renpy/angle/gldraw.pyx":525
 * 
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_68), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

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

  /* "renpy/angle/gldraw.pyx":529
 * 
 * 
 *         renpy.display.log.write("Using {0} renderer.".format(self.info["renderer"]))             # <<<<<<<<<<<<<<
 * 
 *         # Figure out the sizes of texture that render properly.
 */
  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_69), __pyx_n_s__format); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyDict_GetItem(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__renderer)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_8));
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __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_8)); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":532
 * 
 *         # Figure out the sizes of texture that render properly.
 *         rv = gltexture.test_texture_sizes(self.environ, self)             # <<<<<<<<<<<<<<
 * 
 *         self.rtt.deinit()
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__test_texture_sizes); 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_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ));
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":534
 *         rv = gltexture.test_texture_sizes(self.environ, self)
 * 
 *         self.rtt.deinit()             # <<<<<<<<<<<<<<
 *         self.environ.deinit()
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt, __pyx_n_s__deinit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __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 = 534; __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/angle/gldraw.pyx":535
 * 
 *         self.rtt.deinit()
 *         self.environ.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if not rv:
 */
  __pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ), __pyx_n_s__deinit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __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 = 535; __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/angle/gldraw.pyx":537
 *         self.environ.deinit()
 * 
 *         if not rv:             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_rv); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_11 = (!__pyx_t_12);
  if (__pyx_t_11) {

    /* "renpy/angle/gldraw.pyx":538
 * 
 *         if not rv:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # Do additional setup needed.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __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_L29;
  }
  __pyx_L29:;

  /* "renpy/angle/gldraw.pyx":541
 * 
 *         # Do additional setup needed.
 *         renpy.display.pgrender.set_rgba_masks()             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__set_rgba_masks); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __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 = 541; __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/angle/gldraw.pyx":543
 *         renpy.display.pgrender.set_rgba_masks()
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("renpy.angle.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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_5should_redraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_5should_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_pf_5renpy_5angle_6gldraw_6GLDraw_5should_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_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)(PyObject *);
  int __pyx_t_7;
  int __pyx_t_8;
  double __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__needs_redraw,&__pyx_n_s__first_pass,0};
  __Pyx_RefNannySetupContext("should_redraw");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__needs_redraw);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__first_pass);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("should_redraw", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "should_redraw") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __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 = 546; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.should_redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

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

  /* "renpy/angle/gldraw.pyx":555
 *         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 = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "renpy/angle/gldraw.pyx":556
 * 
 *         if needs_redraw:
 *             rv = True             # <<<<<<<<<<<<<<
 *         elif first_pass:
 *             rv = True
 */
    __pyx_v_rv = 1;
    goto __pyx_L6;
  }

  /* "renpy/angle/gldraw.pyx":557
 *         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 = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "renpy/angle/gldraw.pyx":558
 *             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_L6;
  }

  /* "renpy/angle/gldraw.pyx":559
 *         elif first_pass:
 *             rv = True
 *         elif time.time() > self.last_redraw_time + self.redraw_period:             # <<<<<<<<<<<<<<
 *             rv = True
 *         else:
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __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 = 559; __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((((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->last_redraw_time + ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->redraw_period)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __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); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __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_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 = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "renpy/angle/gldraw.pyx":560
 *             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_L6;
  }
  /*else*/ {

    /* "renpy/angle/gldraw.pyx":563
 *         else:
 *             # Redraw if the mouse moves.
 *             mx, my, tex = self.mouse_info             # <<<<<<<<<<<<<<
 *             if tex and (mx, my) != pygame.mouse.get_pos():
 *                 rv = True
 */
    if ((likely(PyTuple_CheckExact(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info))) || (PyList_CheckExact(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info))) {
      PyObject* sequence = ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 3)) {
          if (PyTuple_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 3)) {
          if (PyList_GET_SIZE(sequence) > 3) __Pyx_RaiseTooManyValuesError(3);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 2); 
      }
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
    } else {
      Py_ssize_t index = -1;
      __pyx_t_5 = PyObject_GetIter(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info); 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_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
      index = 0; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 1; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 2; __pyx_t_2 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L8_unpacking_done;
      __pyx_L7_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L8_unpacking_done:;
    }
    __pyx_v_mx = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_my = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_tex = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "renpy/angle/gldraw.pyx":564
 *             # 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 = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(__pyx_v_mx);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mx);
      __Pyx_GIVEREF(__pyx_v_mx);
      __Pyx_INCREF(__pyx_v_my);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_my);
      __Pyx_GIVEREF(__pyx_v_my);
      __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__mouse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__get_pos); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_t_2), __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_8 = __pyx_t_7;
    } else {
      __pyx_t_8 = __pyx_t_1;
    }
    if (__pyx_t_8) {

      /* "renpy/angle/gldraw.pyx":565
 *             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_L9;
    }
    __pyx_L9:;
  }
  __pyx_L6:;

  /* "renpy/angle/gldraw.pyx":568
 * 
 *         # Store the redraw time.
 *         if rv:             # <<<<<<<<<<<<<<
 *             self.last_redraw_time = time.time()
 *             return True
 */
  if (__pyx_v_rv) {

    /* "renpy/angle/gldraw.pyx":569
 *         # Store the redraw time.
 *         if rv:
 *             self.last_redraw_time = time.time()             # <<<<<<<<<<<<<<
 *             return True
 *         else:
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__time); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->last_redraw_time = __pyx_t_9;

    /* "renpy/angle/gldraw.pyx":570
 *         if rv:
 *             self.last_redraw_time = time.time()
 *             return True             # <<<<<<<<<<<<<<
 *         else:
 *             return False
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __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_L10;
  }
  /*else*/ {

    /* "renpy/angle/gldraw.pyx":572
 *             return True
 *         else:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *     def mutated_surface(self, surf):
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L10:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.should_redraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_mx);
  __Pyx_XDECREF(__pyx_v_my);
  __Pyx_XDECREF(__pyx_v_tex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_6mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_6mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("mutated_surface");

  /* "renpy/angle/gldraw.pyx":575
 * 
 *     def mutated_surface(self, surf):
 *         if surf in self.texture_cache:             # <<<<<<<<<<<<<<
 *             del self.texture_cache[surf]
 * 
 */
  __pyx_t_1 = ((PySequence_Contains(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_v_surf))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "renpy/angle/gldraw.pyx":576
 *     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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_v_surf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  __pyx_L5:;

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

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_7load_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_7load_texture[] = "\n        Loads a texture into memory.\n        ";
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_7load_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surf = 0;
  PyObject *__pyx_v_transient = 0;
  PyObject *__pyx_v_rv = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surf,&__pyx_n_s__transient,0};
  __Pyx_RefNannySetupContext("load_texture");
  {
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_70;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__surf);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__transient);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "load_texture") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __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 = 578; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.load_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "renpy/angle/gldraw.pyx":585
 *         # Turn a surface into a texture grid.
 * 
 *         rv = self.texture_cache.get(surf, None)             # <<<<<<<<<<<<<<
 * 
 *         if rv is None:
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_n_s__get); 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 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 585; __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/angle/gldraw.pyx":587
 *         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);
  if (__pyx_t_4) {

    /* "renpy/angle/gldraw.pyx":588
 * 
 *         if rv is None:
 *             rv = gltexture.texture_grid_from_surface(surf, transient)             # <<<<<<<<<<<<<<
 *             self.texture_cache[surf] = rv
 * 
 */
    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s_71); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __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 = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_3));
    __Pyx_INCREF(__pyx_v_surf);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surf);
    __Pyx_GIVEREF(__pyx_v_surf);
    __Pyx_INCREF(__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 = 588; __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(__pyx_v_rv);
    __pyx_v_rv = __pyx_t_1;
    __pyx_t_1 = 0;

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

  /* "renpy/angle/gldraw.pyx":591
 *             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.angle.gldraw.GLDraw.load_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/angle/gldraw.pyx":593
 *         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_5angle_6gldraw_6GLDraw_8solid_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_8solid_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_color = 0;
  PyObject *__pyx_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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__w,&__pyx_n_s__h,&__pyx_n_s__color,0};
  __Pyx_RefNannySetupContext("solid_texture");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__color);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("solid_texture", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "solid_texture") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __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 = 593; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.solid_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "renpy/angle/gldraw.pyx":594
 * 
 *     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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__surface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __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 = 594; __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 = 594; __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 = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __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 = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_4));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __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/angle/gldraw.pyx":595
 *     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 = PyObject_GetAttr(__pyx_v_surf, __pyx_n_s__fill); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __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 = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 595; __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/angle/gldraw.pyx":596
 *         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 = PyObject_GetAttr(__pyx_v_surf, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __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 = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 596; __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(__pyx_v_surf);
  __pyx_v_surf = __pyx_t_1;
  __pyx_t_1 = 0;

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

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_9clip_mode_screen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_9clip_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_pf_5renpy_5angle_6gldraw_6GLDraw_9clip_mode_screen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clip_mode_screen");

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

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

  /* "renpy/angle/gldraw.pyx":612
 *         self.clip_rtt_box = None
 * 
 *         self.environ.unset_clip(self)             # <<<<<<<<<<<<<<
 * 
 *     # private
 */
  ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ->__pyx_vtab)->unset_clip(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ, ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self));

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

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

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

  /* "renpy/angle/gldraw.pyx":621
 * 
 *         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 = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":623
 *         self.clip_rtt_box = (x, y, w, h)
 * 
 *         self.environ.unset_clip(self)             # <<<<<<<<<<<<<<
 * 
 *     # private
 */
  ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ->__pyx_vtab)->unset_clip(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ, ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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.angle.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/angle/gldraw.pyx":626
 * 
 *     # private
 *     cpdef set_clip(GLDraw self, tuple clip):             # <<<<<<<<<<<<<<
 * 
 *         if self.clip_cache == clip:
 */

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static PyObject *__pyx_f_5renpy_5angle_6gldraw_6GLDraw_set_clip(struct __pyx_obj_5renpy_5angle_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");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__set_clip); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11set_clip)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 626; __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/angle/gldraw.pyx":628
 *     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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "renpy/angle/gldraw.pyx":629
 * 
 *         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/angle/gldraw.pyx":631
 *             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/angle/gldraw.pyx":633
 *         self.clip_cache = clip
 * 
 *         self.environ.set_clip(clip, self)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  ((struct __pyx_vtabstruct_5renpy_5angle_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.angle.gldraw.GLDraw.set_clip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11set_clip(PyObject *__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");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_clip), (&PyTuple_Type), 1, "clip", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->set_clip(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_clip, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __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.angle.gldraw.GLDraw.set_clip", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12draw_screen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_12draw_screen[] = "\n        Draws the screen.\n        ";
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12draw_screen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surftree = 0;
  PyObject *__pyx_v_fullscreen_video = 0;
  PyObject *__pyx_v_flip = 0;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surftree,&__pyx_n_s__fullscreen_video,&__pyx_n_s__flip,0};
  __Pyx_RefNannySetupContext("draw_screen");
  {
    PyObject* values[3] = {0,0,0};
    values[2] = __pyx_k_72;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__surftree);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fullscreen_video);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_screen", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __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, PyTuple_GET_SIZE(__pyx_args), "draw_screen") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __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 = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.draw_screen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "renpy/angle/gldraw.pyx":641
 *         """
 * 
 *         forward = reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         surftree.is_opaque()
 */
  __Pyx_INCREF(__pyx_v_5renpy_5angle_6gldraw_IDENTITY);
  __pyx_v_forward = __pyx_v_5renpy_5angle_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_v_5renpy_5angle_6gldraw_IDENTITY);
  __pyx_v_reverse = __pyx_v_5renpy_5angle_6gldraw_IDENTITY;

  /* "renpy/angle/gldraw.pyx":643
 *         forward = reverse = IDENTITY
 * 
 *         surftree.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         self.draw_render_textures(surftree, 0)
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_surftree, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __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 = 643; __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/angle/gldraw.pyx":645
 *         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_5angle_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_render_textures(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surftree, 0, 0);

  /* "renpy/angle/gldraw.pyx":647
 *         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)
 * 
 */
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __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 = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __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 = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __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 = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __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 = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ->__pyx_vtab)->viewport(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6);

  /* "renpy/angle/gldraw.pyx":648
 * 
 *         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()
 */
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __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 = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __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 = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ->__pyx_vtab)->ortho(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ, 0.0, __pyx_t_7, __pyx_t_8, 0.0, -1.0, 1.0);

  /* "renpy/angle/gldraw.pyx":650
 *         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 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__clip_mode_screen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __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 = 650; __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/angle/gldraw.pyx":652
 *         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/angle/gldraw.pyx":653
 * 
 *         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/angle/gldraw.pyx":655
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 *         self.default_clip = (0, 0, self.virtual_size[0], self.virtual_size[1])             # <<<<<<<<<<<<<<
 *         clip = self.default_clip
 * 
 */
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __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 = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->default_clip);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->default_clip));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->default_clip = __pyx_t_9;
  __pyx_t_9 = 0;

  /* "renpy/angle/gldraw.pyx":656
 * 
 *         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_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->default_clip));
  __pyx_v_clip = ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->default_clip;

  /* "renpy/angle/gldraw.pyx":658
 *         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 = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __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 = 658; __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;
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __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 = 658; __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 = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->upscale_factor = __pyx_t_8;

  /* "renpy/angle/gldraw.pyx":660
 *         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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__audio); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __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_GetAttr(__pyx_t_2, __pyx_n_s__music); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__get_playing); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __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_73), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __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 = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_10) {
    __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __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_GetAttr(__pyx_t_2, __pyx_n_s__video); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__fullscreen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __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 = 660; __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/angle/gldraw.pyx":661
 * 
 *         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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__video); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __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_GetAttr(__pyx_t_2, __pyx_n_s__render_movie); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __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_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 1, sizeof(long), PyInt_FromLong); if (!__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 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 661; __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/angle/gldraw.pyx":662
 *         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);
    if (__pyx_t_12) {

      /* "renpy/angle/gldraw.pyx":663
 *             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 = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_1 = __pyx_v_reverse;
      __Pyx_INCREF(__pyx_t_1);
      ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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_t_1), 0);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;
    goto __pyx_L6;
  }
  /*else*/ {

    /* "renpy/angle/gldraw.pyx":666
 * 
 *         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 = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = __pyx_v_reverse;
    __Pyx_INCREF(__pyx_t_1);
    ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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_t_1), 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L6:;

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

    /* "renpy/angle/gldraw.pyx":670
 *         if flip:
 * 
 *             self.draw_mouse()             # <<<<<<<<<<<<<<
 * 
 *             IF not ANGLE:
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__draw_mouse); 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_t_13 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __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/angle/gldraw.pyx":675
 *                 pygame.display.flip()
 *             ELSE:
 *                 egl_swap()             # <<<<<<<<<<<<<<
 * 
 *         gl_check("draw_screen")
 */
    egl_swap();
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "renpy/angle/gldraw.pyx":677
 *                 egl_swap()
 * 
 *         gl_check("draw_screen")             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned):
 */
  __pyx_t_13 = ((PyObject *)__pyx_n_s__draw_screen);
  __Pyx_INCREF(__pyx_t_13);
  __pyx_t_1 = __pyx_f_5renpy_5angle_2gl_gl_check(__pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __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;

  __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.angle.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/angle/gldraw.pyx":679
 *         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_5angle_6gldraw_6GLDraw_13draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_5angle_6gldraw_6GLDraw_draw_render_textures(struct __pyx_obj_5renpy_5angle_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;
  PyObject *__pyx_v_cxo = NULL;
  PyObject *__pyx_v_cyo = NULL;
  PyObject *__pyx_v_focus = NULL;
  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");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_74); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13draw_render_textures)) {
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_non_aligned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __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 = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 679; __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 = 679; __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/angle/gldraw.pyx":688
 *         cdef bint render_what
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_TypeCheck(__pyx_v_what, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_6 = (!__pyx_t_5);
  if (__pyx_t_6) {

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

  /* "renpy/angle/gldraw.pyx":691
 *             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/angle/gldraw.pyx":693
 *         rend = <render.Render> what
 * 
 *         render_what = False             # <<<<<<<<<<<<<<
 * 
 *         if rend.clipping and non_aligned:
 */
  __pyx_v_render_what = 0;

  /* "renpy/angle/gldraw.pyx":695
 *         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) {
    __pyx_t_6 = __pyx_v_non_aligned;
  } else {
    __pyx_t_6 = __pyx_v_rend->clipping;
  }
  if (__pyx_t_6) {

    /* "renpy/angle/gldraw.pyx":696
 * 
 *         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);
    if (!__pyx_t_6) {
      __pyx_t_5 = (__pyx_v_rend->forward->ydx != 0.0);
      __pyx_t_7 = __pyx_t_5;
    } else {
      __pyx_t_7 = __pyx_t_6;
    }
    if (__pyx_t_7) {

      /* "renpy/angle/gldraw.pyx":697
 *         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/angle/gldraw.pyx":698
 *             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/angle/gldraw.pyx":700
 *                 non_aligned = False
 * 
 *         first = True             # <<<<<<<<<<<<<<
 * 
 *         if rend.forward:
 */
  __pyx_v_first = 1;

  /* "renpy/angle/gldraw.pyx":702
 *         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 = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "renpy/angle/gldraw.pyx":703
 * 
 *         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/angle/gldraw.pyx":704
 *         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/angle/gldraw.pyx":706
 *             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 = 706; __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;
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++;
    if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
      PyObject* sequence = __pyx_t_2;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
          if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __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 {
        if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
          if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __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);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_13 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __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;
      index = 0; __pyx_t_3 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_3);
      index = 1; __pyx_t_9 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      index = 2; __pyx_t_10 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_10);
      index = 3; __pyx_t_11 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_11);
      index = 4; __pyx_t_12 = __pyx_t_14(__pyx_t_13); if (unlikely(!__pyx_t_12)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_13), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __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;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L10_unpacking_done:;
    }
    __Pyx_XDECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_v_cxo);
    __pyx_v_cxo = __pyx_t_9;
    __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_v_cyo);
    __pyx_v_cyo = __pyx_t_10;
    __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_v_focus);
    __pyx_v_focus = __pyx_t_11;
    __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_v_main);
    __pyx_v_main = __pyx_t_12;
    __pyx_t_12 = 0;

    /* "renpy/angle/gldraw.pyx":708
 *         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_5angle_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_render_textures(__pyx_v_self, __pyx_v_child, __pyx_v_non_aligned, 0);

    /* "renpy/angle/gldraw.pyx":710
 *             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_5angle_6gldraw_DISSOLVE);
    if (__pyx_t_7) {

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

        /* "renpy/angle/gldraw.pyx":712
 *             if rend.operation == DISSOLVE:
 *                 if not self.fast_dissolve:
 *                     child.render_to_texture(what.operation_alpha)             # <<<<<<<<<<<<<<
 * 
 *             elif rend.operation == IMAGEDISSOLVE:
 */
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_12 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __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 = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__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 = 712; __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/angle/gldraw.pyx":714
 *                     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_5angle_6gldraw_IMAGEDISSOLVE);
    if (__pyx_t_7) {

      /* "renpy/angle/gldraw.pyx":715
 * 
 *             elif rend.operation == IMAGEDISSOLVE:
 *                 child.render_to_texture(first or what.operation_alpha)             # <<<<<<<<<<<<<<
 *                 first = False
 * 
 */
      __pyx_t_12 = PyObject_GetAttr(__pyx_v_child, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __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 = 715; __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 = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      if (!__pyx_t_7) {
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_2 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __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 = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 715; __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/angle/gldraw.pyx":716
 *             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/angle/gldraw.pyx":718
 *                 first = False
 * 
 *             elif rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *                 p = rend.operation_parameter
 *                 pc = child
 */
    __pyx_t_7 = (__pyx_v_rend->operation == __pyx_v_5renpy_5angle_6gldraw_PIXELLATE);
    if (__pyx_t_7) {

      /* "renpy/angle/gldraw.pyx":719
 * 
 *             elif rend.operation == PIXELLATE:
 *                 p = rend.operation_parameter             # <<<<<<<<<<<<<<
 *                 pc = child
 * 
 */
      __Pyx_INCREF(__pyx_v_rend->operation_parameter);
      __Pyx_XDECREF(__pyx_v_p);
      __pyx_v_p = __pyx_v_rend->operation_parameter;

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

      /* "renpy/angle/gldraw.pyx":722
 *                 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); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (!__pyx_t_7) break;

        /* "renpy/angle/gldraw.pyx":723
 * 
 *                 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 = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_v_p);
        __pyx_v_p = __pyx_t_10;
        __pyx_t_10 = 0;

        /* "renpy/angle/gldraw.pyx":724
 *                 while p > 1:
 *                     p /= 2
 *                     pc = self.get_half(pc)             # <<<<<<<<<<<<<<
 * 
 *         if render_what:
 */
        __pyx_t_10 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_half); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 724; __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 = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(((PyObject *)__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 = 724; __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(__pyx_v_pc);
        __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/angle/gldraw.pyx":726
 *                     pc = self.get_half(pc)
 * 
 *         if render_what:             # <<<<<<<<<<<<<<
 *             what.render_to_texture(True)
 * 
 */
  if (__pyx_v_render_what) {

    /* "renpy/angle/gldraw.pyx":727
 * 
 *         if render_what:
 *             what.render_to_texture(True)             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_transformed(
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_12 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __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 = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 727; __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.angle.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;
}

/* "renpy/angle/gldraw.pyx":679
 *         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_5angle_6gldraw_6GLDraw_13draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_13draw_render_textures[] = "\n        This is responsible for rendering things to textures,\n        as necessary.\n        ";
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  int __pyx_v_non_aligned;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__non_aligned,0};
  __Pyx_RefNannySetupContext("draw_render_textures");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__non_aligned);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_render_textures", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "draw_render_textures") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __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 = 679; __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 = 679; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.draw_render_textures", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_render_textures(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_non_aligned, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __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.angle.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/angle/gldraw.pyx":729
 *             what.render_to_texture(True)
 * 
 *     cpdef int draw_transformed(             # <<<<<<<<<<<<<<
 *         GLDraw self,
 *         object what,
 */

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_14draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5renpy_5angle_6gldraw_6GLDraw_draw_transformed(struct __pyx_obj_5renpy_5angle_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;
  PyObject *__pyx_v_focus = NULL;
  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;
  double __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("draw_transformed");
  __Pyx_INCREF(__pyx_v_clip);
  __Pyx_INCREF((PyObject *)__pyx_v_reverse);
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__draw_transformed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_14draw_transformed)) {
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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 = 729; __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 = 729; __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 = 729; __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 = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 729; __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 = 729; __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/angle/gldraw.pyx":743
 *         cdef render.Matrix2D child_reverse
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, gltexture.TextureGrid):
 */
  __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_TypeCheck(__pyx_v_what, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_9 = (!__pyx_t_8);
  if (__pyx_t_9) {

    /* "renpy/angle/gldraw.pyx":745
 *         if not isinstance(what, render.Render):
 * 
 *             if isinstance(what, gltexture.TextureGrid):             # <<<<<<<<<<<<<<
 * 
 *                 self.set_clip(clip)
 */
    __pyx_t_1 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_5angle_9gltexture_TextureGrid));
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_9 = __Pyx_TypeCheck(__pyx_v_what, __pyx_t_1); 
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_9) {

      /* "renpy/angle/gldraw.pyx":747
 *             if isinstance(what, gltexture.TextureGrid):
 * 
 *                 self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *                 gltexture.blit(
 */
      __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_5angle_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 = 747; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

      /* "renpy/angle/gldraw.pyx":757
 *                     over,
 *                     self.environ,
 *                     False)             # <<<<<<<<<<<<<<
 * 
 *                 return 0
 */
      __pyx_t_5 = __pyx_f_5renpy_5angle_9gltexture_blit(((struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *)__pyx_v_what), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)__pyx_t_1), 0, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __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/angle/gldraw.pyx":759
 *                     False)
 * 
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, pygame.Surface):
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

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

      /* "renpy/angle/gldraw.pyx":763
 *             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 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__load_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __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 = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 763; __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/angle/gldraw.pyx":764
 * 
 *                 tex = self.load_texture(what)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, over, reverse)             # <<<<<<<<<<<<<<
 *                 return 0
 * 
 */
      ((struct __pyx_vtabstruct_5renpy_5angle_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/angle/gldraw.pyx":765
 *                 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/angle/gldraw.pyx":767
 *                 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 = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_kp_s_75), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; __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 = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 767; __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 = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "renpy/angle/gldraw.pyx":769
 *             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 = 769; __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/angle/gldraw.pyx":773
 *         # Other draw modes.
 * 
 *         if rend.operation == DISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             if self.fast_dissolve:
 */
  __pyx_t_9 = (__pyx_v_rend->operation == __pyx_v_5renpy_5angle_6gldraw_DISSOLVE);
  if (__pyx_t_9) {

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

      /* "renpy/angle/gldraw.pyx":781
 *                 # of dissolve on Ren'Py proper.
 * 
 *                 self.draw_transformed(rend.children[0][0],             # <<<<<<<<<<<<<<
 *                                       clip, xo, yo, alpha, over, reverse)
 * 
 */
      __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __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); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/angle/gldraw.pyx":782
 * 
 *                 self.draw_transformed(rend.children[0][0],
 *                                       clip, xo, yo, alpha, over, reverse)             # <<<<<<<<<<<<<<
 * 
 *                 self.draw_transformed(rend.children[1][0],
 */
      ((struct __pyx_vtabstruct_5renpy_5angle_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/angle/gldraw.pyx":784
 *                                       clip, xo, yo, alpha, over, reverse)
 * 
 *                 self.draw_transformed(rend.children[1][0],             # <<<<<<<<<<<<<<
 *                                       clip, xo, yo, alpha * what.operation_complete, over, reverse)
 * 
 */
      __pyx_t_6 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __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); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;

      /* "renpy/angle/gldraw.pyx":785
 * 
 *                 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 = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_complete); 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);
      __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_t_1); 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_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 = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      ((struct __pyx_vtabstruct_5renpy_5angle_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/angle/gldraw.pyx":789
 *             else:
 * 
 *                 self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *                 gltexture.blend(
 */
      __pyx_t_5 = ((struct __pyx_vtabstruct_5renpy_5angle_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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "renpy/angle/gldraw.pyx":792
 * 
 *                 gltexture.blend(
 *                     rend.children[0][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                     rend.children[1][0].render_to_texture(what.operation_alpha),
 *                     xo,
 */
      __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __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); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __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_GetAttr(__pyx_t_4, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __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 = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __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 = 792; __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_5angle_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/angle/gldraw.pyx":793
 *                 gltexture.blend(
 *                     rend.children[0][0].render_to_texture(what.operation_alpha),
 *                     rend.children[1][0].render_to_texture(what.operation_alpha),             # <<<<<<<<<<<<<<
 *                     xo,
 *                     yo,
 */
      __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __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); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __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_GetAttr(__pyx_t_5, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __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 = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 793; __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_5angle_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "renpy/angle/gldraw.pyx":800
 *                     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_5angle_9gltexture_blend(((struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *)__pyx_t_4), ((struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw_Environ *)__pyx_t_6), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __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/angle/gldraw.pyx":802
 *                     self.environ)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         elif rend.operation == IMAGEDISSOLVE:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }

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

    /* "renpy/angle/gldraw.pyx":806
 *         elif rend.operation == IMAGEDISSOLVE:
 * 
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             gltexture.imageblend(
 */
    __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_5angle_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 = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":809
 * 
 *             gltexture.imageblend(
 *                 rend.children[0][0].render_to_texture(True),             # <<<<<<<<<<<<<<
 *                 rend.children[1][0].render_to_texture(what.operation_alpha),
 *                 rend.children[2][0].render_to_texture(what.operation_alpha),
 */
    __pyx_t_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __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); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __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 = 809; __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 = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 809; __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_5angle_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/angle/gldraw.pyx":810
 *             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,
 */
    __pyx_t_5 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __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); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __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_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __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 = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __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 = 810; __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_5angle_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/angle/gldraw.pyx":811
 *                 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,
 */
    __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __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); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __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_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __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 = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 811; __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_5angle_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/angle/gldraw.pyx":818
 *                 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 = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "renpy/angle/gldraw.pyx":819
 *                 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_5angle_9gltexture_imageblend(((struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *)__pyx_t_6), ((struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *)__pyx_t_1), ((struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw_Environ *)__pyx_t_3), 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_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/angle/gldraw.pyx":821
 *                 self.environ)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "renpy/angle/gldraw.pyx":824
 * 
 * 
 *         if rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *             self.set_clip(clip)
 * 
 */
  __pyx_t_9 = (__pyx_v_rend->operation == __pyx_v_5renpy_5angle_6gldraw_PIXELLATE);
  if (__pyx_t_9) {

    /* "renpy/angle/gldraw.pyx":825
 * 
 *         if rend.operation == PIXELLATE:
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             p = rend.operation_parameter
 */
    __pyx_t_4 = ((struct __pyx_vtabstruct_5renpy_5angle_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 = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

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

    /* "renpy/angle/gldraw.pyx":828
 * 
 *             p = rend.operation_parameter
 *             pc = rend.children[0][0]             # <<<<<<<<<<<<<<
 * 
 *             while p > 1:
 */
    __pyx_t_4 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __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); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __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/angle/gldraw.pyx":830
 *             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); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_9) break;

      /* "renpy/angle/gldraw.pyx":831
 * 
 *             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 = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_v_p);
      __pyx_v_p = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "renpy/angle/gldraw.pyx":832
 *             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 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__get_half); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 832; __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 = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__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 = 832; __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(__pyx_v_pc);
      __pyx_v_pc = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "renpy/angle/gldraw.pyx":834
 *                 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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __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_GetAttr(__pyx_t_4, __pyx_n_s__render); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__Matrix2D); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __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 = 834; __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 = PyObject_GetAttr(__pyx_v_pc, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __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 = 834; __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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __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 = 834; __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 = PyObject_GetAttr(__pyx_v_pc, __pyx_n_s__height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __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 = 834; __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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 834; __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 = 834; __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 = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_reverse));
    __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_1);
    __pyx_t_1 = 0;

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

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

    /* "renpy/angle/gldraw.pyx":844
 *                 over,
 *                 self.environ,
 *                 True)             # <<<<<<<<<<<<<<
 * 
 *             return 0
 */
    __pyx_t_4 = __pyx_f_5renpy_5angle_9gltexture_blit(((struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *)__pyx_t_1), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_over, ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)__pyx_t_3), 1, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __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_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

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

  /* "renpy/angle/gldraw.pyx":850
 * 
 *         # Compute clipping.
 *         if rend.clipping:             # <<<<<<<<<<<<<<
 * 
 *             # Non-aligned clipping uses RTT.
 */
  if (__pyx_v_rend->clipping) {

    /* "renpy/angle/gldraw.pyx":853
 * 
 *             # 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);
    if (!__pyx_t_9) {
      __pyx_t_8 = (__pyx_v_reverse->xdy != 0.0);
      __pyx_t_11 = __pyx_t_8;
    } else {
      __pyx_t_11 = __pyx_t_9;
    }
    if (__pyx_t_11) {

      /* "renpy/angle/gldraw.pyx":854
 *             # 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_4 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 854; __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 = 854; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_1));
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __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 = 854; __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_v_tex = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "renpy/angle/gldraw.pyx":855
 *             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_5angle_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/angle/gldraw.pyx":856
 *                 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/angle/gldraw.pyx":858
 *                 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 (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
    } else {
      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_clip), 4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_minx = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_v_miny = __pyx_t_1;
    __pyx_t_1 = 0;
    __pyx_v_maxx = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_maxy = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "renpy/angle/gldraw.pyx":862
 *             # 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 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__width); 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_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__height); 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_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __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_12, 0)); 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);
    if (likely(PyTuple_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __Pyx_UnpackTupleError(__pyx_t_5, 2);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_v_tw = __pyx_t_4;
    __pyx_t_4 = 0;
    __pyx_v_th = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "renpy/angle/gldraw.pyx":864
 *             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 = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_v_tw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_12 = __pyx_v_xo;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __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_5 = __pyx_t_1;
    } else {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __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_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 864; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_minx);
    __pyx_v_minx = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/angle/gldraw.pyx":865
 * 
 *             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_3 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_v_tw); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_12 = __pyx_v_xo;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
    } else {
      __pyx_t_4 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __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_INCREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_INCREF(__pyx_v_maxx);
    __pyx_t_3 = __pyx_v_maxx;
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __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_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_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_maxx);
    __pyx_v_maxx = __pyx_t_4;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "renpy/angle/gldraw.pyx":866
 *             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_yo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_v_th); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_12 = __pyx_v_yo;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __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_4 = __pyx_t_1;
    } else {
      __pyx_t_5 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = 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_miny);
    __pyx_t_4 = __pyx_v_miny;
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __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_5 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = __pyx_t_4;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_miny);
    __pyx_v_miny = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/angle/gldraw.pyx":867
 *             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_5 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyNumber_Add(__pyx_t_5, __pyx_v_th); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_12 = __pyx_v_yo;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __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_5 = __pyx_t_1;
    } else {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_v_maxy);
    __pyx_t_5 = __pyx_v_maxy;
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_11) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_3 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_3 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_v_maxy);
    __pyx_v_maxy = __pyx_t_3;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

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

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

  /* "renpy/angle/gldraw.pyx":872
 * 
 *         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/angle/gldraw.pyx":875
 * 
 *         # 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);
  if (__pyx_t_11) {

    /* "renpy/angle/gldraw.pyx":876
 *         # 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_L13;
  }
  __pyx_L13:;

  /* "renpy/angle/gldraw.pyx":878
 *             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) {
    __pyx_t_9 = (((PyObject *)__pyx_v_rend->reverse) != __pyx_v_5renpy_5angle_6gldraw_IDENTITY);
    __pyx_t_8 = __pyx_t_9;
  } else {
    __pyx_t_8 = __pyx_t_11;
  }
  if (__pyx_t_8) {

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

    /* "renpy/angle/gldraw.pyx":881
 *             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_L14:;

  /* "renpy/angle/gldraw.pyx":883
 *             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 = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
  }
  __pyx_t_3 = ((PyObject *)__pyx_v_rend->visible_children); __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = 0;
  for (;;) {
    if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_3)) break;
    __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_1); __pyx_t_13++;
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      if (likely(PyTuple_CheckExact(sequence))) {
        if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) {
          if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 4); 
      } else {
        if (unlikely(PyList_GET_SIZE(sequence) != 5)) {
          if (PyList_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5);
          else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_2 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 4); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_15 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_5)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_4 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_4)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_4);
      index = 2; __pyx_t_6 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_6)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 3; __pyx_t_2 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_2)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_2);
      index = 4; __pyx_t_14 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L17_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L18_unpacking_done;
      __pyx_L17_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
      if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L18_unpacking_done:;
    }
    __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_v_child);
    __pyx_v_child = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_v_cxo = __pyx_t_12;
    __pyx_v_cyo = __pyx_t_10;
    __Pyx_XDECREF(__pyx_v_focus);
    __pyx_v_focus = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_v_main);
    __pyx_v_main = __pyx_t_14;
    __pyx_t_14 = 0;

    /* "renpy/angle/gldraw.pyx":884
 * 
 *         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/angle/gldraw.pyx":885
 *         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/angle/gldraw.pyx":887
 *             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_5angle_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_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":889
 *             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_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_WriteUnraisable("renpy.angle.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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_14draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_14draw_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;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__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};
  __Pyx_RefNannySetupContext("draw_transformed");
  {
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__clip);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xo);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__yo);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__over);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reverse);
        if (likely(values[6])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "draw_transformed") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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 = 733; __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 = 734; __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 = 735; __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 = 736; __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 = 729; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.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 = 732; __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 = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_5angle_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, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __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.angle.gldraw.GLDraw.draw_transformed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_5angle_6gldraw_17render_to_texture_draw_func = {__Pyx_NAMESTR("draw_func"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_17render_to_texture_draw_func, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_cur_scope;
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_outer_scope;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__w,&__pyx_n_s__h,0};
  __Pyx_RefNannySetupContext("draw_func");
  __pyx_outer_scope = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *)__pyx_self;
  __pyx_cur_scope = __pyx_outer_scope;
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "draw_func") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __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 = 897; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.render_to_texture.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_1 = PyObject_GetAttr(((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 = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/angle/gldraw.pyx":899
 *         def draw_func(x, y, w, h):
 * 
 *             self.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             if alpha:
 */
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 899; __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;
  if (unlikely(!__pyx_cur_scope->__pyx_v_alpha)) { __Pyx_RaiseClosureNameError("alpha"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __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 = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/angle/gldraw.pyx":901
 *             self.clip_mode_rtt(x, y, w, h)
 * 
 *             if alpha:             # <<<<<<<<<<<<<<
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)
 *             else:
 */
  if (__pyx_t_4) {

    /* "renpy/angle/gldraw.pyx":902
 * 
 *             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_L6;
  }
  /*else*/ {

    /* "renpy/angle/gldraw.pyx":904
 *                 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_L6:;

  /* "renpy/angle/gldraw.pyx":906
 *                 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);
  if (unlikely(!__pyx_cur_scope->__pyx_v_what)) { __Pyx_RaiseClosureNameError("what"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/angle/gldraw.pyx":908
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             self.default_clip = (0, 0, what.width, what.height)             # <<<<<<<<<<<<<<
 *             clip = self.default_clip
 * 
 */
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __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 = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":909
 * 
 *             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_INCREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->default_clip));
  __pyx_v_clip = __pyx_cur_scope->__pyx_v_self->default_clip;

  /* "renpy/angle/gldraw.pyx":911
 *             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 = 911; __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 = 911; __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_5angle_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.angle.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/angle/gldraw.pyx":891
 *         return 0
 * 
 *     def render_to_texture(self_, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         cdef GLDraw self = self_
 */

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_15render_to_texture(PyObject *__pyx_v_self_, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_15render_to_texture(PyObject *__pyx_v_self_, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *__pyx_cur_scope;
  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;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__alpha,0};
  __Pyx_RefNannySetupContext("render_to_texture");
  __pyx_cur_scope = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *)__pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture->tp_new(__pyx_ptype_5renpy_5angle_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);
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render_to_texture", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "render_to_texture") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __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_INCREF(values[0]);
    __pyx_cur_scope->__pyx_v_what = values[0];
    __Pyx_INCREF(values[1]);
    __pyx_cur_scope->__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 = 891; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.render_to_texture", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_what); __pyx_cur_scope->__pyx_v_what = 0;
  __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_alpha); __pyx_cur_scope->__pyx_v_alpha = 0;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alpha);

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

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

  /* "renpy/angle/gldraw.pyx":897
 *         forward = reverse = IDENTITY
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_5angle_6gldraw_17render_to_texture_draw_func, ((PyObject*)__pyx_cur_scope), __pyx_n_s_39); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_v_draw_func);
  __pyx_v_draw_func = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":913
 *             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 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_TypeCheck(__pyx_t_1, __pyx_t_2); 
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "renpy/angle/gldraw.pyx":914
 * 
 *         if isinstance(what, render.Render):
 *             what.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         self.upscale_factor = 1.0
 */
    __pyx_t_2 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 914; __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 = 914; __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_L6;
  }
  __pyx_L6:;

  /* "renpy/angle/gldraw.pyx":916
 *             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/angle/gldraw.pyx":918
 *         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_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_76); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_draw_func);
  PyTuple_SET_ITEM(__pyx_t_5, 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_5, 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_5, 4, ((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
  __Pyx_GIVEREF(((PyObject *)__pyx_cur_scope->__pyx_v_self->environ));
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __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_5)); __pyx_t_5 = 0;
  __pyx_v_rv = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/angle/gldraw.pyx":920
 *         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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.angle.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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_16is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_16is_pixel_opaque[] = "\n        Returns true if the pixel is not 100% transparent.\n        ";
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_16is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_what = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("is_pixel_opaque");
  {
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__what);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("is_pixel_opaque", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "is_pixel_opaque") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __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 = 923; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.is_pixel_opaque", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_what);

  /* "renpy/angle/gldraw.pyx":928
 *         """
 * 
 *         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); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __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 = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (!__pyx_t_2) {
    __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_int_0, Py_LT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!__pyx_t_3) {
      __pyx_t_1 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_t_1, Py_GE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (!__pyx_t_5) {
        __pyx_t_4 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_1 = PyObject_RichCompare(__pyx_v_y, __pyx_t_4, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; __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/angle/gldraw.pyx":929
 * 
 *         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_L6;
  }
  __pyx_L6:;

  /* "renpy/angle/gldraw.pyx":931
 *             return 0
 * 
 *         if self.always_opaque:             # <<<<<<<<<<<<<<
 *             return 255
 * 
 */
  if (((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->always_opaque) {

    /* "renpy/angle/gldraw.pyx":932
 * 
 *         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_L7;
  }
  __pyx_L7:;

  /* "renpy/angle/gldraw.pyx":934
 *             return 255
 * 
 *         what = what.subsurface((x, y, 1, 1))             # <<<<<<<<<<<<<<
 * 
 *         forward = reverse = IDENTITY
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 934; __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 = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 934; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 934; __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(__pyx_v_what);
  __pyx_v_what = __pyx_t_4;
  __pyx_t_4 = 0;

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

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

  /* "renpy/angle/gldraw.pyx":939
 * 
 *         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/angle/gldraw.pyx":941
 *         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/angle/gldraw.pyx":943
 *         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_5angle_6gldraw_Environ *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ->__pyx_vtab)->ortho(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ, 0.0, 1.0, 0.0, 1.0, -1.0, 1.0);

  /* "renpy/angle/gldraw.pyx":945
 *         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 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__clip_mode_rtt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_77), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __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/angle/gldraw.pyx":947
 *         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_78));
  __pyx_v_clip = __pyx_k_tuple_78;

  /* "renpy/angle/gldraw.pyx":949
 *         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 = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = __pyx_v_reverse;
  __Pyx_INCREF(__pyx_t_8);
  ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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_t_8), 0);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "renpy/angle/gldraw.pyx":953
 *         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/angle/gldraw.pyx":955
 *         glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel)
 * 
 *         a = pixel[3]             # <<<<<<<<<<<<<<
 * 
 *         what.kill()
 */
  __pyx_v_a = (__pyx_v_pixel[3]);

  /* "renpy/angle/gldraw.pyx":957
 *         a = pixel[3]
 * 
 *         what.kill()             # <<<<<<<<<<<<<<
 * 
 *         return a
 */
  __pyx_t_8 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__kill); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __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 = 957; __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/angle/gldraw.pyx":959
 *         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 = 959; __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.angle.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;
}

/* "renpy/angle/gldraw.pyx":979
 *         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_5angle_6gldraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_5angle_6gldraw_8get_half_draw_func = {__Pyx_NAMESTR("draw_func"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_8get_half_draw_func, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *__pyx_cur_scope;
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *__pyx_outer_scope;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__w,&__pyx_n_s__h,0};
  __Pyx_RefNannySetupContext("draw_func");
  __pyx_outer_scope = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *)__pyx_self;
  __pyx_cur_scope = __pyx_outer_scope;
  __pyx_self = __pyx_self;
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("draw_func", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "draw_func") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 979; __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 = 979; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.get_half.draw_func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "renpy/angle/gldraw.pyx":981
 *         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/angle/gldraw.pyx":982
 * 
 *             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);
  if (unlikely(!__pyx_cur_scope->__pyx_v_draw)) { __Pyx_RaiseClosureNameError("draw"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_1 = PyObject_GetAttr(((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 = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/angle/gldraw.pyx":984
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             draw.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             clip = (0, 0, width, height)
 */
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 984; __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;
  if (unlikely(!__pyx_cur_scope->__pyx_v_width)) { __Pyx_RaiseClosureNameError("width"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __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 = 986; __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 = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/angle/gldraw.pyx":986
 *             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)
 */
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __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 = __pyx_t_3;
  __pyx_t_3 = 0;
  if (unlikely(!__pyx_cur_scope->__pyx_v_what)) { __Pyx_RaiseClosureNameError("what"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }__pyx_t_3 = __pyx_cur_scope->__pyx_v_what;

  /* "renpy/angle/gldraw.pyx":988
 *             clip = (0, 0, width, height)
 * 
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(what, render.Render):
 */
  __Pyx_INCREF(__pyx_t_3);
  if (unlikely(!__pyx_cur_scope->__pyx_v_reverse)) { __Pyx_RaiseClosureNameError("reverse"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __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 = 988; __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_5angle_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.angle.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/angle/gldraw.pyx":962
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_17get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_6GLDraw_17get_half[] = "\n        Gets a texture grid that's half the size of what..\n        ";
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_17get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *__pyx_cur_scope;
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_half");
  __pyx_cur_scope = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *)__pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half->tp_new(__pyx_ptype_5renpy_5angle_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_INCREF(__pyx_v_what);
  __pyx_cur_scope->__pyx_v_what = __pyx_v_what;
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);

  /* "renpy/angle/gldraw.pyx":968
 *         # 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(__pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __pyx_cur_scope->__pyx_v_draw = ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self);

  /* "renpy/angle/gldraw.pyx":970
 *         cdef GLDraw draw = self
 * 
 *         if what.half_cache:             # <<<<<<<<<<<<<<
 *             return what.half_cache
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__half_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/angle/gldraw.pyx":971
 * 
 *         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 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__half_cache); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "renpy/angle/gldraw.pyx":973
 *             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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__Matrix2D); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __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 = 973; __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 = 973; __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 = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __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 = 973; __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/angle/gldraw.pyx":974
 * 
 *         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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__render); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __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_GetAttr(__pyx_t_4, __pyx_n_s__Matrix2D); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __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 = 974; __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 = 974; __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 = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __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 = 974; __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/angle/gldraw.pyx":976
 *         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 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __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 = 976; __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 = 976; __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); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __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 = 976; __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 = 976; __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_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_width = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":977
 * 
 *         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_3 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__height); 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_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_int_2); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __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 = 977; __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 = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_cur_scope->__pyx_v_height = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":979
 *         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_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_5angle_6gldraw_8get_half_draw_func, ((PyObject*)__pyx_cur_scope), __pyx_n_s_39); 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_XDECREF(__pyx_v_draw_func);
  __pyx_v_draw_func = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":990
 *             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_1 = ((PyObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render));
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_TypeCheck(__pyx_t_3, __pyx_t_1); 
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "renpy/angle/gldraw.pyx":991
 * 
 *         if isinstance(what, render.Render):
 *             what.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt, self.environ)
 */
    __pyx_t_1 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_what, __pyx_n_s__is_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __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;
    goto __pyx_L6;
  }
  __pyx_L6:;

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

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

  /* "renpy/angle/gldraw.pyx":997
 *         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.angle.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;
}

/* "renpy/angle/gldraw.pyx":999
 *         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_5angle_6gldraw_6GLDraw_18update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_18update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update_mouse");

  /* "renpy/angle/gldraw.pyx":1003
 *         # 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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_19translate_mouse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_19translate_mouse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  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;
  long __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("translate_mouse");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("translate_mouse", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "translate_mouse") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1005; __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 = 1005; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.translate_mouse", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);

  /* "renpy/angle/gldraw.pyx":1008
 * 
 *         # Screen sizes.
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box
 */
  if (likely(PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size)))) {
    PyObject* sequence = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
    if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
      if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
      else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_pw = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_ph = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":1009
 *         # Screen sizes.
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size             # <<<<<<<<<<<<<<
 *         vx, vy, vbw, vbh = self.virtual_box
 * 
 */
  if (likely(PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size)))) {
    PyObject* sequence = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size);
    if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
      if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
      else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_1);
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_vw = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vh = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":1010
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box             # <<<<<<<<<<<<<<
 * 
 *         # Translate to fractional screen.
 */
  if (likely(PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box)))) {
    PyObject* sequence = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box);
    if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
      if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
      else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_4);
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box), 4);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_vx = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_vy = __pyx_t_2;
  __pyx_t_2 = 0;
  __pyx_v_vbw = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_vbh = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/angle/gldraw.pyx":1013
 * 
 *         # Translate to fractional screen.
 *         x = 1.0 * x / pw             # <<<<<<<<<<<<<<
 *         y = 1.0 * y / ph
 * 
 */
  __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __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_PyNumber_Divide(__pyx_t_3, __pyx_v_pw); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_x);
  __pyx_v_x = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "renpy/angle/gldraw.pyx":1014
 *         # Translate to fractional screen.
 *         x = 1.0 * x / pw
 *         y = 1.0 * y / ph             # <<<<<<<<<<<<<<
 * 
 *         # Translate to virtual size.
 */
  __pyx_t_4 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __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_PyNumber_Divide(__pyx_t_3, __pyx_v_ph); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_y);
  __pyx_v_y = __pyx_t_4;
  __pyx_t_4 = 0;

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

  /* "renpy/angle/gldraw.pyx":1018
 *         # Translate to virtual size.
 *         x = vx + vbw * x
 *         y = vy + vbh * y             # <<<<<<<<<<<<<<
 * 
 *         x = int(x)
 */
  __pyx_t_3 = PyNumber_Multiply(__pyx_v_vbh, __pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyNumber_Add(__pyx_v_vy, __pyx_t_3); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_y);
  __pyx_v_y = __pyx_t_4;
  __pyx_t_4 = 0;

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

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

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

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

  /* "renpy/angle/gldraw.pyx":1025
 *         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_5 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_4, Py_GT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_6) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = __pyx_t_1;
  } else {
    __pyx_t_2 = PyInt_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_INCREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_v_y);
  __pyx_v_y = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":1026
 *         x = min(vw, x)
 *         y = max(0, y)
 *         y = min(vh, y)             # <<<<<<<<<<<<<<
 * 
 *         return x, y
 */
  __Pyx_INCREF(__pyx_v_y);
  __pyx_t_3 = __pyx_v_y;
  __Pyx_INCREF(__pyx_v_vh);
  __pyx_t_1 = __pyx_v_vh;
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_1, Py_LT); 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_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_6) {
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = __pyx_t_3;
  } else {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_y);
  __pyx_v_y = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "renpy/angle/gldraw.pyx":1028
 *         y = min(vh, y)
 * 
 *         return x, y             # <<<<<<<<<<<<<<
 * 
 *     def mouse_event(self, ev):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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_r = ((PyObject *)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.angle.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;
}

/* "renpy/angle/gldraw.pyx":1030
 *         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_5angle_6gldraw_6GLDraw_20mouse_event(PyObject *__pyx_v_self, PyObject *__pyx_v_ev); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_20mouse_event(PyObject *__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");

  /* "renpy/angle/gldraw.pyx":1031
 * 
 *     def mouse_event(self, ev):
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())             # <<<<<<<<<<<<<<
 *         return self.translate_mouse(x, y)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_n_s__pos);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__mouse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__get_pos); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __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_GetAttr3(__pyx_v_ev, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
    PyObject* sequence = __pyx_t_2;
    if (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_t_1);
    __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 = 1031; __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_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_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_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 = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_3;
  __pyx_t_3 = 0;
  __pyx_v_y = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":1032
 *     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_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__translate_mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.mouse_event", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "renpy/angle/gldraw.pyx":1034
 *         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_5angle_6gldraw_6GLDraw_21get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_21get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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");

  /* "renpy/angle/gldraw.pyx":1035
 * 
 *     def get_mouse_pos(self):
 *         x, y = pygame.mouse.get_pos()             # <<<<<<<<<<<<<<
 *         return self.translate_mouse(x, y)
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); 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_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__get_pos); 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(__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 = 1035; __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 (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __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);
    __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 = 1035; __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_L5_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_L5_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 = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_y = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":1036
 *     def get_mouse_pos(self):
 *         x, y = pygame.mouse.get_pos()
 *         return self.translate_mouse(x, y)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__translate_mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; __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 = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 1036; __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.angle.gldraw.GLDraw.get_mouse_pos", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_x);
  __Pyx_XDECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_22draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_22draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  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;
  PyObject *__pyx_v_pbw = NULL;
  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");

  /* "renpy/angle/gldraw.pyx":1042
 *     def draw_mouse(self):
 * 
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()             # <<<<<<<<<<<<<<
 * 
 *         self.mouse_info = (mx, my, tex)
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__game); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__interface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__get_mouse_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __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 = 1042; __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 (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
        if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
      __pyx_t_5 = PyTuple_GET_ITEM(sequence, 3); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 4)) {
        if (PyList_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_2 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
      __pyx_t_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);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __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;
    index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_2);
    index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_3);
    index = 2; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_4);
    index = 3; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L6_unpacking_done;
    __pyx_L5_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L6_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/angle/gldraw.pyx":1044
 *         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 = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_info = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":1046
 *         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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible, __pyx_v_hardware, Py_NE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_8) {

    /* "renpy/angle/gldraw.pyx":1047
 * 
 *         if self.mouse_old_visible != hardware:
 *             pygame.mouse.set_visible(hardware)             # <<<<<<<<<<<<<<
 *             self.mouse_old_visible = hardware
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __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_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__mouse); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __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_GetAttr(__pyx_t_5, __pyx_n_s__set_visible); 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_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 1047; __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/angle/gldraw.pyx":1048
 *         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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
    ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible = __pyx_v_hardware;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "renpy/angle/gldraw.pyx":1050
 *             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 = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_9 = (!__pyx_t_8);
  if (__pyx_t_9) {

    /* "renpy/angle/gldraw.pyx":1051
 * 
 *         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_L8;
  }
  __pyx_L8:;

  /* "renpy/angle/gldraw.pyx":1053
 *             return
 * 
 *         x, y = pygame.mouse.get_pos()             # <<<<<<<<<<<<<<
 * 
 *         x -= mx
 */
  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__mouse); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__get_pos); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_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 = 1053; __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 (likely(PyTuple_CheckExact(sequence))) {
      if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
        if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
        if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
        else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_1 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_1);
    __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 = 1053; __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_L9_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_L9_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 = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __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;
    if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
    if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L10_unpacking_done:;
  }
  __pyx_v_x = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_y = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":1055
 *         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 = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_v_x);
  __pyx_v_x = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":1056
 * 
 *         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 = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_v_y);
  __pyx_v_y = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":1058
 *         y -= my
 * 
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         pbx, pby, pbw, pbh = self.physical_box
 * 
 */
  if (likely(PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size)))) {
    PyObject* sequence = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
    if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
      if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
      else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); 
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_1);
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_pw = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_ph = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "renpy/angle/gldraw.pyx":1059
 * 
 *         pw, ph = self.physical_size
 *         pbx, pby, pbw, pbh = self.physical_box             # <<<<<<<<<<<<<<
 * 
 *         self.environ.viewport(0, 0, pw, ph)
 */
  if (likely(PyTuple_CheckExact(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box)))) {
    PyObject* sequence = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box);
    if (unlikely(PyTuple_GET_SIZE(sequence) != 4)) {
      if (PyTuple_GET_SIZE(sequence) > 4) __Pyx_RaiseTooManyValuesError(4);
      else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
    __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
    __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
    __pyx_t_3 = PyTuple_GET_ITEM(sequence, 3); 
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_t_3);
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 4);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_v_pbx = __pyx_t_1;
  __pyx_t_1 = 0;
  __pyx_v_pby = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_pbw = __pyx_t_4;
  __pyx_t_4 = 0;
  __pyx_v_pbh = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":1061
 *         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 = 1061; __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 = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ->__pyx_vtab)->viewport(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ, 0, 0, __pyx_t_10, __pyx_t_11);

  /* "renpy/angle/gldraw.pyx":1062
 * 
 *         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 = 1062; __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 = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_5angle_6gldraw_Environ *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ->__pyx_vtab)->ortho(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ, 0.0, __pyx_t_12, __pyx_t_13, 0.0, -1.0, 1.0);

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

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

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

  /* "renpy/angle/gldraw.pyx":1069
 *         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 = 1069; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "renpy/angle/gldraw.pyx":1070
 *             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 = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "renpy/angle/gldraw.pyx":1074
 *             1.0,
 *             1.0,
 *             self.environ,             # <<<<<<<<<<<<<<
 *             False)
 * 
 */
  __pyx_t_4 = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->environ);
  __Pyx_INCREF(__pyx_t_4);

  /* "renpy/angle/gldraw.pyx":1075
 *             1.0,
 *             self.environ,
 *             False)             # <<<<<<<<<<<<<<
 * 
 *     def screenshot(self, surftree, fullscreen_video):
 */
  __pyx_t_1 = __pyx_f_5renpy_5angle_9gltexture_blit(((struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *)__pyx_t_3), __pyx_t_13, __pyx_t_12, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_5), 1.0, 1.0, ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)__pyx_t_4), 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.angle.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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_23screenshot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_23screenshot(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_surftree = 0;
  PyObject *__pyx_v_fullscreen_video = 0;
  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;
  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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  long __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surftree,&__pyx_n_s__fullscreen_video,0};
  __Pyx_RefNannySetupContext("screenshot");
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__surftree);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fullscreen_video);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("screenshot", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "screenshot") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __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 = 1077; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.GLDraw.screenshot", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "renpy/angle/gldraw.pyx":1086
 * 
 *         # 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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__surface_unscaled); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __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 = 1086; __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 = 1086; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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 = 1086; __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/angle/gldraw.pyx":1087
 *         # 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/angle/gldraw.pyx":1090
 * 
 *         # 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/angle/gldraw.pyx":1093
 * 
 *         # 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);
  if (__pyx_t_4) {

    /* "renpy/angle/gldraw.pyx":1094
 *         # 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 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__draw_screen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __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 = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__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 = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_2));
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__flip), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __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_3)); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

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

  /* "renpy/angle/gldraw.pyx":1105
 *             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/angle/gldraw.pyx":1108
 * 
 *         # 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/angle/gldraw.pyx":1109
 *         # Copy the pixels from raw_pixels to the surface.
 *         pixels = <unsigned char *> surf.pixels
 *         pitch = surf.pitch             # <<<<<<<<<<<<<<
 *         rpp = raw_pixels
 * 
 */
  __pyx_v_pitch = __pyx_v_surf->pitch;

  /* "renpy/angle/gldraw.pyx":1110
 *         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/angle/gldraw.pyx":1112
 *         rpp = raw_pixels
 * 
 *         for y from 0 <= y < surf.h:             # <<<<<<<<<<<<<<
 *             for x from 0 <= x < (surf.w * 4):
 *                 pixels[x] = rpp[x]
 */
  __pyx_t_6 = __pyx_v_surf->h;
  for (__pyx_v_y = 0; __pyx_v_y < __pyx_t_6; __pyx_v_y++) {

    /* "renpy/angle/gldraw.pyx":1113
 * 
 *         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->w * 4);
    for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_7; __pyx_v_x++) {

      /* "renpy/angle/gldraw.pyx":1114
 *         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/angle/gldraw.pyx":1116
 *                 pixels[x] = rpp[x]
 * 
 *             pixels += pitch             # <<<<<<<<<<<<<<
 *             rpp += surf.w * 4
 * 
 */
    __pyx_v_pixels = (__pyx_v_pixels + __pyx_v_pitch);

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

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

  /* "renpy/angle/gldraw.pyx":1122
 * 
 *         # 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_5 = PyObject_GetAttr(__pyx_v_full, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __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_2)); __pyx_t_2 = 0;
  __pyx_v_rv = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":1123
 *         # 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_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__flip_unscaled); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __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 = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_rv);
  __pyx_v_rv = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":1125
 *         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_5);
  __Pyx_AddTraceback("renpy.angle.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;
}

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

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

  /* "renpy/angle/gldraw.pyx":1128
 * 
 *     def free_memory(self):
 *         self.texture_cache.clear()             # <<<<<<<<<<<<<<
 *         gltexture.dealloc_textures()
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __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 = 1128; __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/angle/gldraw.pyx":1129
 *     def free_memory(self):
 *         self.texture_cache.clear()
 *         gltexture.dealloc_textures()             # <<<<<<<<<<<<<<
 * 
 *     def event_peek_sleep(self):
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dealloc_textures); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __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 = 1129; __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.angle.gldraw.GLDraw.free_memory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_25event_peek_sleep(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_25event_peek_sleep(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("event_peek_sleep");

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

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_26get_physical_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_26get_physical_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_physical_size");

  /* "renpy/angle/gldraw.pyx":1135
 * 
 *     def get_physical_size(self):
 *         return self.physical_size             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_3rtt___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_3rtt___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->rtt);
  __pyx_r = ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

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

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

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

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

/* "renpy/angle/gldraw.pxd":15
 *     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_5angle_6gldraw_6GLDraw_13physical_size___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13physical_size___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13physical_size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13physical_size_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(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 = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_size = ((PyObject*)__pyx_v_value);

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

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

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

/* "renpy/angle/gldraw.pxd":16
 *     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_5angle_6gldraw_6GLDraw_11virtual_box___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11virtual_box___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11virtual_box_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11virtual_box_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(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 = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->virtual_box = ((PyObject*)__pyx_v_value);

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

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

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

/* "renpy/angle/gldraw.pxd":17
 *     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_5angle_6gldraw_6GLDraw_12physical_box___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12physical_box___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12physical_box_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12physical_box_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(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 = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->physical_box = ((PyObject*)__pyx_v_value);

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

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

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

/* "renpy/angle/gldraw.pxd":23
 *     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_5angle_6gldraw_6GLDraw_4info___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4info___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4info_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4info_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(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 = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->info = ((PyObject*)__pyx_v_value);

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

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

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

/* "renpy/angle/gldraw.pxd":25
 *     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_5angle_6gldraw_6GLDraw_18fullscreen_surface___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_18fullscreen_surface___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  __pyx_r = ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

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

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

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

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

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12clip_rtt_box___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12clip_rtt_box___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__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;
}

static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12clip_rtt_box_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12clip_rtt_box_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(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(((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box));
  ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box = ((PyObject*)__pyx_v_value);

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

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

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

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_3Rtt_init(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_5angle_6gldraw_3Rtt_init = {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_3Rtt_init, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_3Rtt_init(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("init");
  __pyx_self = __pyx_self;

  /* "renpy/angle/gldraw.pyx":1144
 * 
 *     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;
}

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

static PyObject *__pyx_pf_5renpy_5angle_6gldraw_3Rtt_1deinit(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_5angle_6gldraw_3Rtt_1deinit = {__Pyx_NAMESTR("deinit"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_3Rtt_1deinit, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_3Rtt_1deinit(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deinit");
  __pyx_self = __pyx_self;

  /* "renpy/angle/gldraw.pyx":1147
 * 
 *     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;
}

/* "renpy/angle/gldraw.pyx":1149
 *         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_5angle_6gldraw_3Rtt_2render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_5angle_6gldraw_3Rtt_2render[] = "\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_5angle_6gldraw_3Rtt_2render = {__Pyx_NAMESTR("render"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_3Rtt_2render, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_3Rtt_2render)};
static PyObject *__pyx_pf_5renpy_5angle_6gldraw_3Rtt_2render(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_texture = 0;
  PyObject *__pyx_v_x = 0;
  PyObject *__pyx_v_y = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_draw_func = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__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};
  __Pyx_RefNannySetupContext("render");
  __pyx_self = __pyx_self;
  {
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      switch (PyTuple_GET_SIZE(__pyx_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 (PyTuple_GET_SIZE(__pyx_args)) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__texture);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w);
        if (likely(values[4])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__h);
        if (likely(values[5])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__draw_func);
        if (likely(values[6])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("render", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "render") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __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 = 1149; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.angle.gldraw.Rtt.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "renpy/angle/gldraw.pyx":1157
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 *     def get_size_limit(self, dimension):
 */
  __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_80), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __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 = 1157; __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.angle.gldraw.Rtt.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

  /* "renpy/angle/gldraw.pyx":1164
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = PyObject_Call(__pyx_builtin_Exception, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __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 = 1164; __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.angle.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/angle/gldraw.pyx":1169
 * 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_5angle_6gldraw_7Environ_blit(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blit");

  __Pyx_RefNannyFinishContext();
}

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

static void __pyx_f_5renpy_5angle_6gldraw_7Environ_blend(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, double __pyx_v_fraction) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("blend");

  __Pyx_RefNannyFinishContext();
}

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

static void __pyx_f_5renpy_5angle_6gldraw_7Environ_imageblend(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, double __pyx_v_fraction, int __pyx_v_ramp) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("imageblend");

  __Pyx_RefNannyFinishContext();
}

/* "renpy/angle/gldraw.pyx":1191
 *         """
 * 
 *     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_5angle_6gldraw_7Environ_set_vertex(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, float *__pyx_v_vertices) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_vertex");

  __Pyx_RefNannyFinishContext();
}

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

static void __pyx_f_5renpy_5angle_6gldraw_7Environ_set_texture(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, int __pyx_v_unit, float *__pyx_v_coords) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_texture");

  __Pyx_RefNannyFinishContext();
}

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

static void __pyx_f_5renpy_5angle_6gldraw_7Environ_set_color(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, float __pyx_v_r, float __pyx_v_g, float __pyx_v_b, float __pyx_v_a) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_color");

  __Pyx_RefNannyFinishContext();
}

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

static void __pyx_f_5renpy_5angle_6gldraw_7Environ_set_clip(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, PyObject *__pyx_v_clip_box, struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *__pyx_v_draw) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("set_clip");

  __Pyx_RefNannyFinishContext();
}

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

static void __pyx_f_5renpy_5angle_6gldraw_7Environ_unset_clip(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *__pyx_v_draw) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("unset_clip");

  __Pyx_RefNannyFinishContext();
}

/* "renpy/angle/gldraw.pyx":1217
 *         """
 * 
 *     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_5angle_6gldraw_7Environ_ortho(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, double __pyx_v_left, double __pyx_v_right, double __pyx_v_bottom, double __pyx_v_top, double __pyx_v_near, double __pyx_v_far) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("ortho");

  __Pyx_RefNannyFinishContext();
}

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

static void __pyx_f_5renpy_5angle_6gldraw_7Environ_viewport(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *__pyx_v_self, int __pyx_v_x, int __pyx_v_y, int __pyx_v_w, int __pyx_v_h) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("viewport");

  __Pyx_RefNannyFinishContext();
}

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

static CYTHON_INLINE PyObject *__pyx_f_5renpy_5angle_2gl_gl_check(PyObject *__pyx_v_where) {
  GLenum __pyx_v_error;
  PyObject *__pyx_v_renpy = 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("gl_check");

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

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

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

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

  __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.angle.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_5angle_6gldraw_Environ __pyx_vtable_5renpy_5angle_6gldraw_Environ;

static PyObject *__pyx_tp_new_5renpy_5angle_6gldraw_Environ(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_5angle_6gldraw_Environ *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_5angle_6gldraw_Environ *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_5angle_6gldraw_Environ;
  return o;
}

static void __pyx_tp_dealloc_5renpy_5angle_6gldraw_Environ(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_5renpy_5angle_6gldraw_Environ[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Environ = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Environ = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Environ = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Environ = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_5angle_6gldraw_Environ = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.angle.gldraw.Environ"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_5angle_6gldraw_Environ), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_5angle_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*/
  &__pyx_tp_as_number_Environ, /*tp_as_number*/
  &__pyx_tp_as_sequence_Environ, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Environ, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Environ, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|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_5angle_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_5angle_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
};
static struct __pyx_vtabstruct_5renpy_5angle_6gldraw_GLDraw __pyx_vtable_5renpy_5angle_6gldraw_GLDraw;

static PyObject *__pyx_tp_new_5renpy_5angle_6gldraw_GLDraw(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_5angle_6gldraw_GLDraw;
  p->environ = ((struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw_GLDraw(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)o;
  Py_XDECREF(((PyObject *)p->environ));
  Py_XDECREF(p->rtt);
  Py_XDECREF(p->window);
  Py_XDECREF(((PyObject *)p->virtual_size));
  Py_XDECREF(((PyObject *)p->physical_size));
  Py_XDECREF(((PyObject *)p->virtual_box));
  Py_XDECREF(((PyObject *)p->physical_box));
  Py_XDECREF(p->mouse_old_visible);
  Py_XDECREF(p->mouse_info);
  Py_XDECREF(p->texture_cache);
  Py_XDECREF(((PyObject *)p->info));
  Py_XDECREF(p->old_fullscreen);
  Py_XDECREF(p->fullscreen_surface);
  Py_XDECREF(p->display_info);
  Py_XDECREF(((PyObject *)p->clip_cache));
  Py_XDECREF(((PyObject *)p->default_clip));
  Py_XDECREF(((PyObject *)p->clip_rtt_box));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_5angle_6gldraw_GLDraw(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw_GLDraw(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->environ);
  p->environ = ((struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw_6GLDraw_rtt(PyObject *o, void *x) {
  return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_3rtt___get__(o);
}

static int __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_rtt(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_3rtt_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_3rtt_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_physical_size(PyObject *o, void *x) {
  return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13physical_size___get__(o);
}

static int __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_physical_size(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13physical_size_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13physical_size_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_virtual_box(PyObject *o, void *x) {
  return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11virtual_box___get__(o);
}

static int __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_virtual_box(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11virtual_box_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11virtual_box_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_physical_box(PyObject *o, void *x) {
  return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12physical_box___get__(o);
}

static int __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_physical_box(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12physical_box_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12physical_box_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_info(PyObject *o, void *x) {
  return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4info___get__(o);
}

static int __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_info(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4info_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4info_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, void *x) {
  return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_18fullscreen_surface___get__(o);
}

static int __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_18fullscreen_surface_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_18fullscreen_surface_2__del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_clip_rtt_box(PyObject *o, void *x) {
  return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12clip_rtt_box___get__(o);
}

static int __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_clip_rtt_box(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12clip_rtt_box_1__set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12clip_rtt_box_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_5renpy_5angle_6gldraw_GLDraw[] = {
  {__Pyx_NAMESTR("set_mode"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_1set_mode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_1set_mode)},
  {__Pyx_NAMESTR("deinit"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_2deinit, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_2deinit)},
  {__Pyx_NAMESTR("quit"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_3quit, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_4init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_4init)},
  {__Pyx_NAMESTR("should_redraw"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_5should_redraw, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_5should_redraw)},
  {__Pyx_NAMESTR("mutated_surface"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_6mutated_surface, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("load_texture"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_7load_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_7load_texture)},
  {__Pyx_NAMESTR("solid_texture"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_8solid_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clip_mode_screen"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_9clip_mode_screen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_9clip_mode_screen)},
  {__Pyx_NAMESTR("clip_mode_rtt"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_10clip_mode_rtt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_10clip_mode_rtt)},
  {__Pyx_NAMESTR("set_clip"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_11set_clip, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("draw_screen"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_12draw_screen, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_12draw_screen)},
  {__Pyx_NAMESTR("draw_render_textures"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_13draw_render_textures, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_13draw_render_textures)},
  {__Pyx_NAMESTR("draw_transformed"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_14draw_transformed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("render_to_texture"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_15render_to_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("is_pixel_opaque"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_16is_pixel_opaque, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_16is_pixel_opaque)},
  {__Pyx_NAMESTR("get_half"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_17get_half, METH_O, __Pyx_DOCSTR(__pyx_doc_5renpy_5angle_6gldraw_6GLDraw_17get_half)},
  {__Pyx_NAMESTR("update_mouse"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_18update_mouse, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("translate_mouse"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_19translate_mouse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("mouse_event"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_20mouse_event, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_mouse_pos"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_21get_mouse_pos, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("draw_mouse"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_22draw_mouse, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("screenshot"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_23screenshot, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("free_memory"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_24free_memory, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("event_peek_sleep"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_25event_peek_sleep, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_physical_size"), (PyCFunction)__pyx_pf_5renpy_5angle_6gldraw_6GLDraw_26get_physical_size, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5renpy_5angle_6gldraw_GLDraw[] = {
  {(char *)"rtt", __pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_rtt, __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_rtt, 0, 0},
  {(char *)"physical_size", __pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_physical_size, __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_physical_size, 0, 0},
  {(char *)"virtual_box", __pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_virtual_box, __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_virtual_box, 0, 0},
  {(char *)"physical_box", __pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_physical_box, __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_physical_box, 0, 0},
  {(char *)"info", __pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_info, __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_info, 0, 0},
  {(char *)"fullscreen_surface", __pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_fullscreen_surface, __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_fullscreen_surface, 0, 0},
  {(char *)"clip_rtt_box", __pyx_getprop_5renpy_5angle_6gldraw_6GLDraw_clip_rtt_box, __pyx_setprop_5renpy_5angle_6gldraw_6GLDraw_clip_rtt_box, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_GLDraw = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_GLDraw = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_GLDraw = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_GLDraw = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_5angle_6gldraw_GLDraw = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.angle.gldraw.GLDraw"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_5angle_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*/
  &__pyx_tp_as_number_GLDraw, /*tp_as_number*/
  &__pyx_tp_as_sequence_GLDraw, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_GLDraw, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_GLDraw, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_5angle_6gldraw_GLDraw, /*tp_traverse*/
  __pyx_tp_clear_5renpy_5angle_6gldraw_GLDraw, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_5angle_6gldraw_GLDraw, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5renpy_5angle_6gldraw_GLDraw, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5renpy_5angle_6gldraw_6GLDraw___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_5angle_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
};

static PyObject *__pyx_tp_new_5renpy_5angle_6gldraw___pyx_scope_struct__init(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *)o);
  p->__pyx_v_extensions = 0;
  return o;
}

static void __pyx_tp_dealloc_5renpy_5angle_6gldraw___pyx_scope_struct__init(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *)o;
  Py_XDECREF(p->__pyx_v_extensions);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_5angle_6gldraw___pyx_scope_struct__init(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw___pyx_scope_struct__init(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *p = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_extensions);
  p->__pyx_v_extensions = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5renpy_5angle_6gldraw___pyx_scope_struct__init[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct__init = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct__init = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct__init = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__init = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct__init = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.angle.gldraw.__pyx_scope_struct__init"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct__init), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_5angle_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*/
  &__pyx_tp_as_number___pyx_scope_struct__init, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct__init, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct__init, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct__init, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_5angle_6gldraw___pyx_scope_struct__init, /*tp_traverse*/
  __pyx_tp_clear_5renpy_5angle_6gldraw___pyx_scope_struct__init, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_5angle_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_5angle_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
};

static PyObject *__pyx_tp_new_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *)o;
  Py_XDECREF(p->__pyx_v_alpha);
  Py_XDECREF(p->__pyx_v_reverse);
  Py_XDECREF(((PyObject *)p->__pyx_v_self));
  Py_XDECREF(p->__pyx_v_what);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw___pyx_scope_struct_1_render_to_texture(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture *p = (struct __pyx_obj_5renpy_5angle_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_5angle_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_5angle_6gldraw___pyx_scope_struct_1_render_to_texture[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1_render_to_texture = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1_render_to_texture = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_1_render_to_texture = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1_render_to_texture = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.angle.gldraw.__pyx_scope_struct_1_render_to_texture"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_5angle_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*/
  &__pyx_tp_as_number___pyx_scope_struct_1_render_to_texture, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_1_render_to_texture, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_1_render_to_texture, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct_1_render_to_texture, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture, /*tp_traverse*/
  __pyx_tp_clear_5renpy_5angle_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_5angle_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_5angle_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
};

static PyObject *__pyx_tp_new_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw___pyx_scope_struct_2_get_half(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *p = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *)o;
  Py_XDECREF(((PyObject *)p->__pyx_v_draw));
  Py_XDECREF(p->__pyx_v_height);
  Py_XDECREF(p->__pyx_v_reverse);
  Py_XDECREF(p->__pyx_v_what);
  Py_XDECREF(p->__pyx_v_width);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *p = (struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw___pyx_scope_struct_2_get_half(PyObject *o) {
  struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *p = (struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_draw);
  p->__pyx_v_draw = ((struct __pyx_obj_5renpy_5angle_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_5angle_6gldraw___pyx_scope_struct_2_get_half[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_2_get_half = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_2_get_half = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_2_get_half = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_2_get_half = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.angle.gldraw.__pyx_scope_struct_2_get_half"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_5angle_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*/
  &__pyx_tp_as_number___pyx_scope_struct_2_get_half, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_2_get_half, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_2_get_half, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer___pyx_scope_struct_2_get_half, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half, /*tp_traverse*/
  __pyx_tp_clear_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_5angle_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_5angle_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
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __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_18, __pyx_k_18, sizeof(__pyx_k_18), 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_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
  {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
  {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 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_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
  {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0},
  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  {&__pyx_n_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 1},
  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
  {&__pyx_n_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 1},
  {&__pyx_n_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 1},
  {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0},
  {&__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_n_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 1},
  {&__pyx_kp_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 0},
  {&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1},
  {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
  {&__pyx_kp_s_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 0, 1, 0},
  {&__pyx_kp_s_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 0, 1, 0},
  {&__pyx_n_s_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 0, 1, 1},
  {&__pyx_n_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 1},
  {&__pyx_kp_s_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 0, 1, 0},
  {&__pyx_kp_s_67, __pyx_k_67, sizeof(__pyx_k_67), 0, 0, 1, 0},
  {&__pyx_kp_s_69, __pyx_k_69, sizeof(__pyx_k_69), 0, 0, 1, 0},
  {&__pyx_n_s_71, __pyx_k_71, sizeof(__pyx_k_71), 0, 0, 1, 1},
  {&__pyx_n_s_74, __pyx_k_74, sizeof(__pyx_k_74), 0, 0, 1, 1},
  {&__pyx_kp_s_75, __pyx_k_75, sizeof(__pyx_k_75), 0, 0, 1, 0},
  {&__pyx_n_s_76, __pyx_k_76, sizeof(__pyx_k_76), 0, 0, 1, 1},
  {&__pyx_kp_s_79, __pyx_k_79, sizeof(__pyx_k_79), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_82, __pyx_k_82, sizeof(__pyx_k_82), 0, 0, 1, 0},
  {&__pyx_n_s_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 0, 1, 1},
  {&__pyx_kp_s_84, __pyx_k_84, sizeof(__pyx_k_84), 0, 0, 1, 0},
  {&__pyx_kp_s_85, __pyx_k_85, sizeof(__pyx_k_85), 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__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__Info, __pyx_k__Info, sizeof(__pyx_k__Info), 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__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__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____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__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__angle, __pyx_k__angle, sizeof(__pyx_k__angle), 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__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_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_enable, __pyx_k__gl_enable, sizeof(__pyx_k__gl_enable), 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__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__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_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__use_gles, __pyx_k__use_gles, sizeof(__pyx_k__use_gles), 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_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");

  /* "renpy/angle/gldraw.pyx":105
 * 
 *         # 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_New(3); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_k_tuple_2, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));

  /* "renpy/angle/gldraw.pyx":156
 * 
 *         if not renpy.config.gl_enable:
 *             renpy.display.log.write("GL Disabled.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));

  /* "renpy/angle/gldraw.pyx":181
 *             renpy.display.interface.post_init()
 * 
 *         renpy.display.log.write("")             # <<<<<<<<<<<<<<
 * 
 *         self.virtual_size = virtual_size
 */
  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));

  /* "renpy/angle/gldraw.pyx":210
 * 
 *         # Handle swap control.
 *         vsync = int(os.environ.get("RENPY_GL_VSYNC", "1"))             # <<<<<<<<<<<<<<
 * 
 *         if ANGLE:
 */
  __pyx_k_tuple_7 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_VSYNC));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__RENPY_GL_VSYNC));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_VSYNC));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s__1));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 1, ((PyObject *)__pyx_kp_s__1));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s__1));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));

  /* "renpy/angle/gldraw.pyx":230
 *         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_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));

  /* "renpy/angle/gldraw.pyx":231
 *             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_New(2); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_10, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));

  /* "renpy/angle/gldraw.pyx":233
 *                 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_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_11));
  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));

  /* "renpy/angle/gldraw.pyx":336
 *             renpy.display.gl_size = self.physical_size
 * 
 *         renpy.display.log.write("Deallocating textures.")             # <<<<<<<<<<<<<<
 *         gltexture.dealloc_textures()
 *         renpy.display.log.write("Done deallocating textures.")
 */
  __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
  PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_s_16));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17));

  /* "renpy/angle/gldraw.pyx":338
 *         renpy.display.log.write("Deallocating textures.")
 *         gltexture.dealloc_textures()
 *         renpy.display.log.write("Done deallocating textures.")             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("About to quit GL.")
 */
  __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
  PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));

  /* "renpy/angle/gldraw.pyx":340
 *         renpy.display.log.write("Done deallocating textures.")
 * 
 *         renpy.display.log.write("About to quit GL.")             # <<<<<<<<<<<<<<
 *         pygame.display.quit()
 *         renpy.display.log.write("Finished quit GL.")
 */
  __pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_21));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
  PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));

  /* "renpy/angle/gldraw.pyx":342
 *         renpy.display.log.write("About to quit GL.")
 *         pygame.display.quit()
 *         renpy.display.log.write("Finished quit GL.")             # <<<<<<<<<<<<<<
 * 
 *         self.old_fullscreen = None
 */
  __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
  PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_s_22));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23));

  /* "renpy/angle/gldraw.pyx":381
 * 
 *         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_29 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_28));
  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_kp_s_28));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_28));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));

  /* "renpy/angle/gldraw.pyx":383
 *             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_31 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_30));
  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_kp_s_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_30));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));

  /* "renpy/angle/gldraw.pyx":386
 * 
 *         if not allow_shader and not allow_fixed:
 *             renpy.display.log.write("GL is totally blacklisted.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_k_tuple_33 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_kp_s_32));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));

  /* "renpy/angle/gldraw.pyx":401
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 *         extensions = set(extensions_string.split(" "))             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.log.write("Extensions:")
 */
  __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_kp_s_34));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));

  /* "renpy/angle/gldraw.pyx":403
 *         extensions = set(extensions_string.split(" "))
 * 
 *         renpy.display.log.write("Extensions:")             # <<<<<<<<<<<<<<
 * 
 *         for i in sorted(extensions):
 */
  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_36));
  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_kp_s_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));

  /* "renpy/angle/gldraw.pyx":450
 * 
 *             try:
 *                 renpy.display.log.write("Using shader environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 */
  __pyx_k_tuple_44 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_44));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_43));
  PyTuple_SET_ITEM(__pyx_k_tuple_44, 0, ((PyObject *)__pyx_kp_s_43));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_43));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_44));

  /* "renpy/angle/gldraw.pyx":456
 * 
 *             except Exception, e:
 *                 renpy.display.log.write("Initializing shader environment failed:")             # <<<<<<<<<<<<<<
 *                 renpy.display.log.exception()
 *                 self.environ = None
 */
  __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_46));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_45));
  PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, ((PyObject *)__pyx_kp_s_45));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_45));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_46));

  /* "renpy/angle/gldraw.pyx":469
 *                 "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_50 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_50));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_49));
  PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_kp_s_49));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_49));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));

  /* "renpy/angle/gldraw.pyx":480
 *                 "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_54 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_53));
  PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, ((PyObject *)__pyx_kp_s_53));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_53));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54));

  /* "renpy/angle/gldraw.pyx":491
 *                 "RENPY_bogus_extension"):
 * 
 *                 renpy.display.log.write("Using limited environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 */
  __pyx_k_tuple_57 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_57));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
  PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_kp_s_56));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));

  /* "renpy/angle/gldraw.pyx":497
 * 
 *             else:
 *                 renpy.display.log.write("Can't find a workable environment.")             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  __pyx_k_tuple_59 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_59));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_58));
  PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_kp_s_58));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_58));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59));

  /* "renpy/angle/gldraw.pyx":502
 *         # 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_60 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_60));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
  PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, ((PyObject *)__pyx_n_s__RENPY_GL_RTT));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__RENPY_GL_RTT));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__copy));
  PyTuple_SET_ITEM(__pyx_k_tuple_60, 1, ((PyObject *)__pyx_n_s__copy));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__copy));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_60));

  /* "renpy/angle/gldraw.pyx":503
 * 
 *         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_62 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_62));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_61));
  PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, ((PyObject *)__pyx_kp_s_61));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_61));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62));

  /* "renpy/angle/gldraw.pyx":519
 *                 "GL_ARB_framebuffer_object")):
 * 
 *             renpy.display.log.write("Using FBO RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 */
  __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_66));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_65));
  PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_65));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_65));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_66));

  /* "renpy/angle/gldraw.pyx":525
 * 
 *         else:
 *             renpy.display.log.write("Can't find a workable rtt.")             # <<<<<<<<<<<<<<
 *             return False
 * 
 */
  __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_68));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_67));
  PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_kp_s_67));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_67));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_68));

  /* "renpy/angle/gldraw.pyx":660
 *         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_73 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_73));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__movie));
  PyTuple_SET_ITEM(__pyx_k_tuple_73, 0, ((PyObject *)__pyx_n_s__movie));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__movie));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_73));

  /* "renpy/angle/gldraw.pyx":945
 *         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_77 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_77));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_77, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_77, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_77, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_77, 3, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_77));

  /* "renpy/angle/gldraw.pyx":947
 *         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_78 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_78));
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_k_tuple_78, 3, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78));

  /* "renpy/angle/gldraw.pyx":1157
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 *     def get_size_limit(self, dimension):
 */
  __pyx_k_tuple_80 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_80));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_79));
  PyTuple_SET_ITEM(__pyx_k_tuple_80, 0, ((PyObject *)__pyx_kp_s_79));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_79));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_80));

  /* "renpy/angle/gldraw.pyx":1164
 *         """
 * 
 *         raise Exception("Not implemented.")             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_81));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_79));
  PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_kp_s_79));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_79));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81));
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  #if PY_VERSION_HEX < 0x02040000
  if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_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_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;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  __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)");
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __pyx_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("gldraw"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_renpy__angle__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_5angle_6gldraw_IDENTITY = Py_None; Py_INCREF(Py_None);
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_5renpy_5angle_6gldraw_Environ = &__pyx_vtable_5renpy_5angle_6gldraw_Environ;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.blit = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *))__pyx_f_5renpy_5angle_6gldraw_7Environ_blit;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.blend = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, double))__pyx_f_5renpy_5angle_6gldraw_7Environ_blend;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.imageblend = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, double, int))__pyx_f_5renpy_5angle_6gldraw_7Environ_imageblend;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.set_vertex = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, float *))__pyx_f_5renpy_5angle_6gldraw_7Environ_set_vertex;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.set_texture = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, int, float *))__pyx_f_5renpy_5angle_6gldraw_7Environ_set_texture;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.set_color = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, float, float, float, float))__pyx_f_5renpy_5angle_6gldraw_7Environ_set_color;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.set_clip = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, PyObject *, struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *))__pyx_f_5renpy_5angle_6gldraw_7Environ_set_clip;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.unset_clip = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *))__pyx_f_5renpy_5angle_6gldraw_7Environ_unset_clip;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.ortho = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, double, double, double, double, double, double))__pyx_f_5renpy_5angle_6gldraw_7Environ_ortho;
  __pyx_vtable_5renpy_5angle_6gldraw_Environ.viewport = (void (*)(struct __pyx_obj_5renpy_5angle_6gldraw_Environ *, int, int, int, int))__pyx_f_5renpy_5angle_6gldraw_7Environ_viewport;
  if (PyType_Ready(&__pyx_type_5renpy_5angle_6gldraw_Environ) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5renpy_5angle_6gldraw_Environ.tp_dict, __pyx_vtabptr_5renpy_5angle_6gldraw_Environ) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "Environ", (PyObject *)&__pyx_type_5renpy_5angle_6gldraw_Environ) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_5angle_6gldraw_Environ = &__pyx_type_5renpy_5angle_6gldraw_Environ;
  __pyx_vtabptr_5renpy_5angle_6gldraw_GLDraw = &__pyx_vtable_5renpy_5angle_6gldraw_GLDraw;
  __pyx_vtable_5renpy_5angle_6gldraw_GLDraw.set_clip = (PyObject *(*)(struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5renpy_5angle_6gldraw_6GLDraw_set_clip;
  __pyx_vtable_5renpy_5angle_6gldraw_GLDraw.draw_render_textures = (int (*)(struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *, PyObject *, int, int __pyx_skip_dispatch))__pyx_f_5renpy_5angle_6gldraw_6GLDraw_draw_render_textures;
  __pyx_vtable_5renpy_5angle_6gldraw_GLDraw.draw_transformed = (int (*)(struct __pyx_obj_5renpy_5angle_6gldraw_GLDraw *, PyObject *, PyObject *, double, double, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, int __pyx_skip_dispatch))__pyx_f_5renpy_5angle_6gldraw_6GLDraw_draw_transformed;
  if (PyType_Ready(&__pyx_type_5renpy_5angle_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5renpy_5angle_6gldraw_GLDraw.tp_dict, __pyx_vtabptr_5renpy_5angle_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GLDraw", (PyObject *)&__pyx_type_5renpy_5angle_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_5angle_6gldraw_GLDraw = &__pyx_type_5renpy_5angle_6gldraw_GLDraw;
  if (PyType_Ready(&__pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct__init) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct__init = &__pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct__init;
  if (PyType_Ready(&__pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture = &__pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct_1_render_to_texture;
  if (PyType_Ready(&__pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half = &__pyx_type_5renpy_5angle_6gldraw___pyx_scope_struct_2_get_half;
  /*--- 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 = 1; __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 = 1; __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 = 9; __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 = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_5angle_9gltexture_TextureCore = __Pyx_ImportType("renpy.angle.gltexture", "TextureCore", sizeof(struct __pyx_obj_5renpy_5angle_9gltexture_TextureCore), 1); if (unlikely(!__pyx_ptype_5renpy_5angle_9gltexture_TextureCore)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_5renpy_5angle_9gltexture_TextureCore = (struct __pyx_vtabstruct_5renpy_5angle_9gltexture_TextureCore*)__Pyx_GetVtable(__pyx_ptype_5renpy_5angle_9gltexture_TextureCore->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_5angle_9gltexture_TextureCore)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_5angle_9gltexture_TextureGrid = __Pyx_ImportType("renpy.angle.gltexture", "TextureGrid", sizeof(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid), 1); if (unlikely(!__pyx_ptype_5renpy_5angle_9gltexture_TextureGrid)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_5renpy_5angle_9gltexture_TextureGrid = (struct __pyx_vtabstruct_5renpy_5angle_9gltexture_TextureGrid*)__Pyx_GetVtable(__pyx_ptype_5renpy_5angle_9gltexture_TextureGrid->tp_dict); if (unlikely(!__pyx_vtabptr_5renpy_5angle_9gltexture_TextureGrid)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("renpy.display.render"); 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, "render", (void (**)(void))&__pyx_f_5renpy_7display_6render_render, "PyObject *(PyObject *, PyObject *, PyObject *, double, double, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_ImportModule("renpy.angle.gltexture"); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportFunction(__pyx_t_2, "blit", (void (**)(void))&__pyx_f_5renpy_5angle_9gltexture_blit, "PyObject *(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, struct __pyx_obj_5renpy_5angle_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_2, "blend", (void (**)(void))&__pyx_f_5renpy_5angle_9gltexture_blend, "PyObject *(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, double, struct __pyx_obj_5renpy_5angle_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_2, "imageblend", (void (**)(void))&__pyx_f_5renpy_5angle_9gltexture_imageblend, "PyObject *(struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_5angle_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, double, int, struct __pyx_obj_5renpy_5angle_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_2); __pyx_t_2 = 0;
  /*--- Execution code ---*/

  /* "renpy/angle/gldraw.pyx":33
 * from gl cimport *
 * 
 * import renpy             # <<<<<<<<<<<<<<
 * import pygame
 * import os
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__renpy), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__renpy, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":34
 * 
 * import renpy
 * import pygame             # <<<<<<<<<<<<<<
 * import os
 * import os.path
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__pygame), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pygame, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":35
 * import renpy
 * import pygame
 * import os             # <<<<<<<<<<<<<<
 * import os.path
 * import weakref
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":36
 * import pygame
 * import os
 * import os.path             # <<<<<<<<<<<<<<
 * import weakref
 * import array
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_83), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__os, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":37
 * import os
 * import os.path
 * import weakref             # <<<<<<<<<<<<<<
 * import array
 * import time
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__weakref), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__weakref, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":38
 * import os.path
 * import weakref
 * import array             # <<<<<<<<<<<<<<
 * import time
 * 
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__array), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":39
 * import weakref
 * import array
 * import time             # <<<<<<<<<<<<<<
 * 
 * cimport renpy.display.render as render
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":43
 * cimport renpy.display.render as render
 * cimport gltexture
 * import gltexture             # <<<<<<<<<<<<<<
 * import glblacklist
 * 
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__gltexture), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gltexture, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":44
 * cimport gltexture
 * import gltexture
 * import glblacklist             # <<<<<<<<<<<<<<
 * 
 * cdef extern from "glcompat.h":
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__glblacklist), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glblacklist, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":63
 * 
 * # This is used by gl_error_check in gl.pxd.
 * class GLError(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     This is used to report OpenGL errors.
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(__pyx_builtin_Exception);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Exception);
  __Pyx_GIVEREF(__pyx_builtin_Exception);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_84)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = __Pyx_CreateClass(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3), __pyx_n_s__GLError, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__GLError, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":72
 * # 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_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__render); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __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_GetAttr(__pyx_t_3, __pyx_n_s__DISSOLVE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_5renpy_5angle_6gldraw_DISSOLVE = __pyx_t_6;

  /* "renpy/angle/gldraw.pyx":73
 * cdef int DISSOLVE, IMAGEDISSOLVE, PIXELLATE
 * DISSOLVE = renpy.display.render.DISSOLVE
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE             # <<<<<<<<<<<<<<
 * PIXELLATE = renpy.display.render.PIXELLATE
 * 
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __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_GetAttr(__pyx_t_3, __pyx_n_s__render); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__IMAGEDISSOLVE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_5renpy_5angle_6gldraw_IMAGEDISSOLVE = __pyx_t_6;

  /* "renpy/angle/gldraw.pyx":74
 * DISSOLVE = renpy.display.render.DISSOLVE
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE
 * PIXELLATE = renpy.display.render.PIXELLATE             # <<<<<<<<<<<<<<
 * 
 * cdef object IDENTITY
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__render); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __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_GetAttr(__pyx_t_3, __pyx_n_s__PIXELLATE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_5renpy_5angle_6gldraw_PIXELLATE = __pyx_t_6;

  /* "renpy/angle/gldraw.pyx":77
 * 
 * cdef object IDENTITY
 * IDENTITY = renpy.display.render.IDENTITY             # <<<<<<<<<<<<<<
 * 
 * cdef class GLDraw:
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __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_GetAttr(__pyx_t_3, __pyx_n_s__render); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__IDENTITY); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_XGOTREF(__pyx_v_5renpy_5angle_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_v_5renpy_5angle_6gldraw_IDENTITY);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_v_5renpy_5angle_6gldraw_IDENTITY = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":81
 * cdef class GLDraw:
 * 
 *     def __init__(self, allow_fixed=True):             # <<<<<<<<<<<<<<
 * 
 *         # Did we do the first-time init?
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_1 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":578
 *             del self.texture_cache[surf]
 * 
 *     def load_texture(self, surf, transient=False):             # <<<<<<<<<<<<<<
 *         """
 *         Loads a texture into memory.
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_70 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":636
 * 
 * 
 *     def draw_screen(self, surftree, fullscreen_video, flip=True):             # <<<<<<<<<<<<<<
 *         """
 *         Draws the screen.
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_72 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":1138
 * 
 * 
 * class Rtt(object):             # <<<<<<<<<<<<<<
 *     """
 *     Subclasses of this class handle rendering to a texture.
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));

  /* "renpy/angle/gldraw.pyx":1143
 *     """
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_5 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_5angle_6gldraw_3Rtt_init, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__init, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":1146
 *         return
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         return
 * 
 */
  __pyx_t_5 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_5angle_6gldraw_3Rtt_1deinit, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__deinit, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":1149
 *         return
 * 
 *     def render(self, texture, x, y, w, h, draw_func):             # <<<<<<<<<<<<<<
 *         """
 *         This function is called to trigger a rendering to a texture.
 */
  __pyx_t_5 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_5angle_6gldraw_3Rtt_2render, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__render, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":1159
 *         raise Exception("Not implemented.")
 * 
 *     def get_size_limit(self, dimension):             # <<<<<<<<<<<<<<
 *         """
 *         Get the maximum size of a texture.
 */
  __pyx_t_5 = __pyx_binding_PyCFunctionType_NewEx(&__pyx_mdef_5renpy_5angle_6gldraw_3Rtt_3get_size_limit, NULL, __pyx_n_s_39); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyObject_SetItem(__pyx_t_3, __pyx_n_s__get_size_limit, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "renpy/angle/gldraw.pyx":1138
 * 
 * 
 * class Rtt(object):             # <<<<<<<<<<<<<<
 *     """
 *     Subclasses of this class handle rendering to a texture.
 */
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_INCREF(__pyx_builtin_object);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_builtin_object);
  __Pyx_GIVEREF(__pyx_builtin_object);
  if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_85)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_4 = __Pyx_CreateClass(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_3), __pyx_n_s__Rtt, __pyx_n_s_39); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Rtt, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "renpy/angle/gldraw.pyx":1231
 * # 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_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "renpy/angle/gldraw.pyx":1232
 * # classes have been created.
 * try:
 *     import glrtt_copy             # <<<<<<<<<<<<<<
 * except:
 *     glrtt_copy = None
 */
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__glrtt_copy), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glrtt_copy, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/angle/gldraw.pyx":1233
 * try:
 *     import glrtt_copy
 * except:             # <<<<<<<<<<<<<<
 *     glrtt_copy = None
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("renpy.angle.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "renpy/angle/gldraw.pyx":1234
 *     import glrtt_copy
 * except:
 *     glrtt_copy = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glrtt_copy, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L9_try_end:;
  }

  /* "renpy/angle/gldraw.pyx":1236
 *     glrtt_copy = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glrtt_fbo
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "renpy/angle/gldraw.pyx":1237
 * 
 * try:
 *     import glrtt_fbo             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glrtt_fbo = None
 */
      __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__glrtt_fbo), 0, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glrtt_fbo, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L19_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/angle/gldraw.pyx":1238
 * try:
 *     import glrtt_fbo
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glrtt_fbo = None
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("renpy.angle.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);

      /* "renpy/angle/gldraw.pyx":1239
 *     import glrtt_fbo
 * except ImportError:
 *     glrtt_fbo = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glrtt_fbo, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L13_exception_handled;
    }
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    __pyx_L19_try_end:;
  }

  /* "renpy/angle/gldraw.pyx":1241
 *     glrtt_fbo = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_fixed
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "renpy/angle/gldraw.pyx":1242
 * 
 * try:
 *     import glenviron_fixed             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_fixed = None
 */
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__glenviron_fixed), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_fixed, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L29_try_end;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/angle/gldraw.pyx":1243
 * try:
 *     import glenviron_fixed
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_fixed = None
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("renpy.angle.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "renpy/angle/gldraw.pyx":1244
 *     import glenviron_fixed
 * except ImportError:
 *     glenviron_fixed = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_fixed, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1244; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L23_exception_handled;
    }
    __pyx_L24_except_error:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L23_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L29_try_end:;
  }

  /* "renpy/angle/gldraw.pyx":1246
 *     glenviron_fixed = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_shader
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_8, &__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    /*try:*/ {

      /* "renpy/angle/gldraw.pyx":1247
 * 
 * try:
 *     import glenviron_shader             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_shader = None
 */
      __pyx_t_5 = __Pyx_Import(((PyObject *)__pyx_n_s__glenviron_shader), 0, -1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_shader, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L39_try_end;
    __pyx_L32_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "renpy/angle/gldraw.pyx":1248
 * try:
 *     import glenviron_shader
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_shader = None
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("renpy.angle.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L34_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_3);

      /* "renpy/angle/gldraw.pyx":1249
 *     import glenviron_shader
 * except ImportError:
 *     glenviron_shader = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_shader, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; __pyx_clineno = __LINE__; goto __pyx_L34_except_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L33_exception_handled;
    }
    __pyx_L34_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    goto __pyx_L1_error;
    __pyx_L33_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_8, __pyx_t_7);
    __pyx_L39_try_end:;
  }

  /* "renpy/angle/gldraw.pyx":1251
 *     glenviron_shader = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import glenviron_limited
 * except ImportError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    /*try:*/ {

      /* "renpy/angle/gldraw.pyx":1252
 * 
 * try:
 *     import glenviron_limited             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_limited = None
 */
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__glenviron_limited), 0, -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
      __Pyx_GOTREF(__pyx_t_3);
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_limited, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; __pyx_clineno = __LINE__; goto __pyx_L42_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L49_try_end;
    __pyx_L42_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "renpy/angle/gldraw.pyx":1253
 * try:
 *     import glenviron_limited
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_limited = None
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("renpy.angle.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);

      /* "renpy/angle/gldraw.pyx":1254
 *     import glenviron_limited
 * except ImportError:
 *     glenviron_limited = None             # <<<<<<<<<<<<<<
 * 
 */
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_limited, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L44_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L43_exception_handled;
    }
    __pyx_L44_except_error:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    goto __pyx_L1_error;
    __pyx_L43_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9);
    __pyx_L49_try_end:;
  }

  /* "renpy/angle/gldraw.pyx":1
 * # This file was automatically generated from renpy/gl/gldraw.pyx             # <<<<<<<<<<<<<<
 * # Modifications will be automatically overwritten.
 * 
 */
  __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;

  /* "gl.pxd":1528
 * 
 * 
 * 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);
  __Pyx_XDECREF(__pyx_t_5);
  if (__pyx_m) {
    __Pyx_AddTraceback("init renpy.angle.gldraw", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init renpy.angle.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_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;

    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    /* unexpected keyword found */
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;

    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else if (PyErr_Occurred()) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
    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;
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
    if (unlikely(tstate->curexc_type))
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
        goto bad;
    #endif
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
    Py_INCREF(local_type);
    Py_INCREF(local_value);
    Py_INCREF(local_tb);
    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 (XDECREF may run arbitrary code). */
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
    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 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 CYTHON_INLINE void __Pyx_RaiseNoneIndexingError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is unsubscriptable");
}

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}


static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();

    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
}

static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;

    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
}


#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    /* cause is unused */
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }

    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

#else /* Python 3+ */

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;

    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }

    if (cause) {
        PyObject *fixed_cause;
        if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        }
        else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        }
        else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }

    PyErr_SetObject(type, value);

    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }

bad:
    return;
}
#endif

static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else if (PyTuple_GET_SIZE(t) < index) {
      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
    } else {
      __Pyx_RaiseTooManyValuesError(index);
    }
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
    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);
}

static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
    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);
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        PyObject *py_level = PyInt_FromLong(level);
        if (!py_level)
            goto bad;
        module = PyObject_CallFunctionObjArgs(py_import,
            name, global_dict, empty_dict, list, py_level, NULL);
        Py_DECREF(py_level);
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) {
    PyObject *metaclass;
    /* Default metaclass */
#if PY_MAJOR_VERSION < 3
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = PyObject_GetAttrString(base, (char *)"__class__");
        if (!metaclass) {
            PyErr_Clear();
            metaclass = (PyObject*) Py_TYPE(base);
        }
    } else {
        metaclass = (PyObject *) &PyClass_Type;
    }
#else
    if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) {
        PyObject *base = PyTuple_GET_ITEM(bases, 0);
        metaclass = (PyObject*) Py_TYPE(base);
    } else {
        metaclass = (PyObject *) &PyType_Type;
    }
#endif
    Py_INCREF(metaclass);
    return metaclass;
}

static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
                                   PyObject *modname) {
    PyObject *result;
    PyObject *metaclass;

    if (PyDict_SetItemString(dict, "__module__", modname) < 0)
        return NULL;

    /* Python2 __metaclass__ */
    metaclass = PyDict_GetItemString(dict, "__metaclass__");
    if (metaclass) {
        Py_INCREF(metaclass);
    } else {
        metaclass = __Pyx_FindPy2Metaclass(bases);
    }
    result = PyObject_CallFunctionObjArgs(metaclass, name, bases, dict, NULL);
    Py_DECREF(metaclass);
    return result;
}


static PyObject *__pyx_binding_PyCFunctionType_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
    __pyx_binding_PyCFunctionType_object *op = PyObject_GC_New(__pyx_binding_PyCFunctionType_object, __pyx_binding_PyCFunctionType);
    if (op == NULL)
        return NULL;
    op->func.m_ml = ml;
    Py_XINCREF(self);
    op->func.m_self = self;
    Py_XINCREF(module);
    op->func.m_module = module;
    PyObject_GC_Track(op);
    return (PyObject *)op;
}

static void __pyx_binding_PyCFunctionType_dealloc(__pyx_binding_PyCFunctionType_object *m) {
    PyObject_GC_UnTrack(m);
    Py_XDECREF(m->func.m_self);
    Py_XDECREF(m->func.m_module);
    PyObject_GC_Del(m);
}

static PyObject *__pyx_binding_PyCFunctionType_descr_get(PyObject *func, PyObject *obj, PyObject *type) {
    if (obj == Py_None)
            obj = NULL;
    return PyMethod_New(func, obj, type);
}

static int __pyx_binding_PyCFunctionType_init(void) {
    __pyx_binding_PyCFunctionType_type = PyCFunction_Type;
    __pyx_binding_PyCFunctionType_type.tp_name = __Pyx_NAMESTR("cython_binding_builtin_function_or_method");
    __pyx_binding_PyCFunctionType_type.tp_dealloc = (destructor)__pyx_binding_PyCFunctionType_dealloc;
    __pyx_binding_PyCFunctionType_type.tp_descr_get = __pyx_binding_PyCFunctionType_descr_get;
    if (PyType_Ready(&__pyx_binding_PyCFunctionType_type) < 0) {
        return -1;
    }
    __pyx_binding_PyCFunctionType = &__pyx_binding_PyCFunctionType_type;
    return 0;

}

static CYTHON_INLINE 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 int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyBytes_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
            else
                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
        } else {
            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {   /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */
        return (equals == Py_EQ);
    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]);
            else
                return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]);
        } else {
            int result = PyUnicode_Compare(s1, s2);
            if ((result == -1) && unlikely(PyErr_Occurred()))
                return -1;
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
}

static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
    PyObject *r = PyObject_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 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);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#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_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(class_name);
    #else
    py_name = PyUnicode_FromString(class_name);
    #endif
    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;
    }
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)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 (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)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_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    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

static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyMapping_GetItemString(dict, (char *)"__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;
}

#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

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
