/* Generated by Cython 0.13 on Sun Feb  6 17:41:45 2011 */

#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)   PyInt_AsLong(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
  #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

#if PY_MAJOR_VERSION >= 3
  #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_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
  #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

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

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE_API__renpy__display__gldraw
#include "pygame/pygame.h"
#include "glcompat.h"

/* 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_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",
  "gl.pxd",
  "gldraw.pxd",
  "render.pxd",
  "gltexture.pxd",
};

/* Type declarations */

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":42
 *     cdef public bint modal
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)             # <<<<<<<<<<<<<<
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 * 
 */

struct __pyx_opt_args_5renpy_7display_6render_6Render_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":43
 * 
 *     cpdef int blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)
 *     cpdef int subpixel_blit(Render self, source, tuple pos, object focus=*, object main=*, object index=*)             # <<<<<<<<<<<<<<
 * 
 * 
 */

struct __pyx_opt_args_5renpy_7display_6render_6Render_subpixel_blit {
  int __pyx_n;
  PyObject *focus;
  PyObject *main;
  PyObject *index;
};

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":954
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */

struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half {
  PyObject_HEAD
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *__pyx_v_draw;
  PyObject *__pyx_v_draw_func;
  PyObject *__pyx_v_forward;
  PyObject *__pyx_v_height;
  PyObject *__pyx_v_reverse;
  PyObject *__pyx_v_rv;
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *__pyx_v_self;
  PyObject *__pyx_v_what;
  PyObject *__pyx_v_width;
};

/* "/home/tom/ab/renpy-mainline/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;
  int width;
  int height;
  PyObject *layer_name;
  PyObject *children;
  PyObject *parents;
  PyObject *depends_on_list;
  int operation;
  double operation_complete;
  int operation_alpha;
  PyObject *operation_parameter;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *forward;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *reverse;
  double alpha;
  PyObject *focuses;
  PyObject *pass_focuses;
  PyObject *draw_func;
  PyObject *render_of;
  int opaque;
  PyObject *visible_children;
  int clipping;
  PyObject *surface;
  PyObject *alpha_surface;
  PyObject *half_cache;
  int modal;
};

/* "/home/tom/ab/renpy-mainline/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;
};

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pxd":3
 * cimport render
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     cdef bint did_init
 */

struct __pyx_obj_5renpy_7display_6gldraw_GLDraw {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *__pyx_vtab;
  int did_init;
  PyObject *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 use_clipping_planes;
  int always_opaque;
  PyObject *clip_rtt_box;
};

struct __pyx_obj_5renpy_7display_9gltexture_TextureCore {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_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;
};

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":27
 *     cpdef int allocate(TextureCore)
 * 
 * cdef class TextureGrid:             # <<<<<<<<<<<<<<
 * 
 *    cdef public int width
 */

struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid {
  PyObject_HEAD
  struct __pyx_vtabstruct_5renpy_7display_9gltexture_TextureGrid *__pyx_vtab;
  int width;
  int height;
  PyObject *rows;
  PyObject *columns;
  PyObject *tiles;
  struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *half_cache;
};

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":883
 *         return 0
 * 
 *     def render_to_texture(self_, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         cdef GLDraw self = self_
 */

struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture {
  PyObject_HEAD
  PyObject *__pyx_v_alpha;
  PyObject *__pyx_v_draw_func;
  PyObject *__pyx_v_forward;
  PyObject *__pyx_v_reverse;
  PyObject *__pyx_v_rv;
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *__pyx_v_self;
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *__pyx_v_self_;
  PyObject *__pyx_v_what;
};

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":358
 *         renpy.log.info("Finished quit GL.")
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does the first-time initialization of OpenGL, deciding
 */

struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init {
  PyObject_HEAD
  GLint __pyx_v_clip_planes;
  PyObject *__pyx_v_e;
  PyObject *__pyx_v_err;
  PyObject *__pyx_v_extensions;
  PyObject *__pyx_v_extensions_string;
  PyObject *__pyx_v_i;
  PyObject *__pyx_v_r;
  PyObject *__pyx_v_renderer;
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *__pyx_v_self;
  GLint __pyx_v_texture_units;
  PyObject *__pyx_v_use_subsystem;
  PyObject *__pyx_v_v;
  PyObject *__pyx_v_version;
};


/* "/home/tom/ab/renpy-mainline/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;


/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":114
 *     ]
 * 
 * cdef class GLDraw:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self):
 */

struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw {
  PyObject *(*set_clip)(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *, PyObject *, int __pyx_skip_dispatch);
  int (*draw_render_textures)(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *, PyObject *, int, int __pyx_skip_dispatch);
  int (*draw_transformed)(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *, PyObject *, PyObject *, double, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *__pyx_vtabptr_5renpy_7display_6gldraw_GLDraw;


/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":3
 * cimport renpy.display.render as render
 * 
 * cdef class TextureCore:             # <<<<<<<<<<<<<<
 *     cdef public int width
 *     cdef public int height
 */

struct __pyx_vtabstruct_5renpy_7display_9gltexture_TextureCore {
  void (*make_ready)(struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *);
  void (*make_nearest)(struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *);
  void (*make_linear)(struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *);
  int (*allocate)(struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5renpy_7display_9gltexture_TextureCore *__pyx_vtabptr_5renpy_7display_9gltexture_TextureCore;


/* "/home/tom/ab/renpy-mainline/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;


/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":27
 *     cpdef int allocate(TextureCore)
 * 
 * cdef class TextureGrid:             # <<<<<<<<<<<<<<
 * 
 *    cdef public int width
 */

struct __pyx_vtabstruct_5renpy_7display_9gltexture_TextureGrid {
  void (*make_ready)(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, int);
};
static struct __pyx_vtabstruct_5renpy_7display_9gltexture_TextureGrid *__pyx_vtabptr_5renpy_7display_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) {
    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;
  }
  #define __Pyx_RefNannySetupContext(name)           void *__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_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
#else
  #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_XDECREF(r) Py_XDECREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *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 int __Pyx_CheckKeywordStrings(PyObject *kwdict,
    const char* function_name, int kw_allowed); /*proto*/

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

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

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
static int __Pyx_EndUnpack(PyObject *, Py_ssize_t expected); /*proto*/

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

static CYTHON_INLINE long __Pyx_NegateNonNeg(long 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 void __Pyx_RaiseNoneNotIterableError(void);

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

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 int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

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

static CYTHON_INLINE long __Pyx_div_long(long, long); /* 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); /*proto*/

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

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_GLenum(GLenum);

static CYTHON_INLINE GLenum __Pyx_PyInt_from_py_GLenum(PyObject *);

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

#define __pyx_binding_PyCFunctionType_USED 1

typedef struct {
    PyCFunctionObject func;
} __pyx_binding_PyCFunctionType_object;

PyTypeObject __pyx_binding_PyCFunctionType_type;
PyTypeObject *__pyx_binding_PyCFunctionType = NULL;

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)

int __pyx_binding_PyCFunctionType_init(void); /* proto */

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_GLint(GLint);

static CYTHON_INLINE GLint __Pyx_PyInt_from_py_GLint(PyObject *);

static CYTHON_INLINE GLsizei __Pyx_PyInt_from_py_GLsizei(PyObject *);

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

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_WriteUnraisable(const char *name); /*proto*/

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

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

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

static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/

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

static void __Pyx_AddTraceback(const char *funcname); /*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 renpy.display.pygame */

/* Module declarations from renpy.display.gl */

static CYTHON_INLINE PyObject *__pyx_f_5renpy_7display_2gl_gl_check(PyObject *); /*proto*/
/* Module declarations from renpy.display.gltexture */

static PyTypeObject *__pyx_ptype_5renpy_7display_9gltexture_TextureCore = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_9gltexture_TextureGrid = 0;
static PyObject *(*__pyx_f_5renpy_7display_9gltexture_blit)(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, PyObject *, int, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_5renpy_7display_9gltexture_blend)(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, PyObject *, int __pyx_skip_dispatch); /*proto*/
static PyObject *(*__pyx_f_5renpy_7display_9gltexture_imageblend)(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, int, PyObject *, int __pyx_skip_dispatch); /*proto*/
/* Module declarations from renpy.display.gldraw */

static PyTypeObject *__pyx_ptype_5renpy_7display_6gldraw_GLDraw = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_init = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture = 0;
static PyTypeObject *__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_get_half = 0;
static int __pyx_v_5renpy_7display_6gldraw_DISSOLVE;
static int __pyx_v_5renpy_7display_6gldraw_IMAGEDISSOLVE;
static int __pyx_v_5renpy_7display_6gldraw_PIXELLATE;
static PyObject *__pyx_v_5renpy_7display_6gldraw_IDENTITY = 0;
static void __pyx_f_5renpy_7display_6gldraw_gl_clip(GLenum, GLdouble, GLdouble, GLdouble, GLdouble); /*proto*/
static int __pyx_f_5renpy_7display_6gldraw_round(double); /*proto*/
#define __Pyx_MODULE_NAME "renpy.display.gldraw"
int __pyx_module_is_main_renpy__display__gldraw = 0;

/* Implementation of renpy.display.gldraw */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_sorted;
static PyObject *__pyx_builtin_getattr;
static char __pyx_k_1[] = "GL Disabled.";
static char __pyx_k_2[] = "";
static char __pyx_k_3[] = "Fullscreen mode.";
static char __pyx_k_4[] = "Windowed mode.";
static char __pyx_k_5[] = "Could not get pygame screen: %r";
static char __pyx_k_6[] = "Screen sizes: virtual=%r physical=%r";
static char __pyx_k_7[] = "Deallocating textures.";
static char __pyx_k_8[] = "Done deallocating textures.";
static char __pyx_k_9[] = "About to quit GL.";
static char __pyx_k_10[] = "Finished quit GL.";
static char __pyx_k_11[] = "Glew init failed: %s";
static char __pyx_k_12[] = "Vendor: %r";
static char __pyx_k_13[] = "Renderer: %r";
static char __pyx_k_14[] = "Version: %r";
static char __pyx_k_15[] = "Display Info: %s";
static char __pyx_k_16[] = "Blacklisted renderer/version.";
static char __pyx_k_17[] = "OpenGL ES";
static char __pyx_k_18[] = " ";
static char __pyx_k_19[] = "Extensions:";
static char __pyx_k_20[] = "    %s";
static char __pyx_k_21[] = "Number of texture units: %d";
static char __pyx_k_22[] = "Number of clipping planes: %d";
static char __pyx_k_23[] = "GL_ARB_vertex_shader";
static char __pyx_k_24[] = "GL_ARB_fragment_shader";
static char __pyx_k_25[] = "Using shader environment.";
static char __pyx_k_26[] = "Initializing shader environment failed:";
static char __pyx_k_27[] = "GL_ARB_texture_env_crossbar";
static char __pyx_k_28[] = "GL_ARB_texture_env_combine";
static char __pyx_k_29[] = "Using fixed-function environment (clause 1).";
static char __pyx_k_30[] = "FixedFunctionEnviron";
static char __pyx_k_31[] = "GL_NV_texture_env_combine4";
static char __pyx_k_32[] = "Using fixed-function environment (clause 2).";
static char __pyx_k_33[] = "RENPY_bogus_extension";
static char __pyx_k_34[] = "Using limited environment.";
static char __pyx_k_35[] = "Can't find a workable environment.";
static char __pyx_k_36[] = "GL_OES_framebuffer_object";
static char __pyx_k_37[] = "Using FBO RTT.";
static char __pyx_k_38[] = "Using copy RTT.";
static char __pyx_k_40[] = "texture_grid_from_surface";
static char __pyx_k_41[] = "draw_render_textures";
static char __pyx_k_42[] = "Unknown drawing type. ";
static char __pyx_k_43[] = "texture_grid_from_drawing";
static char __pyx_k_44[] = "GL error 0x%X at %s";
static char __pyx_k_45[] = "os.path";
static char __pyx_k_46[] = "renpy.display.gltexture";
static char __pyx_k_47[] = "*";
static char __pyx_k_48[] = "renpy.display.glenviron";
static char __pyx_k_49[] = "renpy.display.glrtt_copy";
static char __pyx_k_50[] = "renpy.display.glenviron_fixed";
static char __pyx_k_51[] = "renpy.display.glenviron_shader";
static char __pyx_k_52[] = "renpy.display.glenviron_limited";
static char __pyx_k_53[] = "renpy.display.glrtt_fbo";
static char __pyx_k_54[] = "\n    This is used to report OpenGL errors.\n    ";
static char __pyx_k_55[] = "S3 Graphics DeltaChrome";
static char __pyx_k_56[] = "1.4 20.00";
static char __pyx_k_57[] = "GLDraw.set_mode (line 177)";
static char __pyx_k_58[] = "GLDraw.deinit (line 326)";
static char __pyx_k_59[] = "GLDraw.init (line 358)";
static char __pyx_k_60[] = "GLDraw.should_redraw (line 515)";
static char __pyx_k_61[] = "GLDraw.clip_mode_screen (line 560)";
static char __pyx_k_62[] = "GLDraw.clip_mode_rtt (line 572)";
static char __pyx_k_63[] = "GLDraw.draw_screen (line 631)";
static char __pyx_k_64[] = "GLDraw.draw_render_textures (line 677)";
static char __pyx_k_65[] = "GLDraw.is_pixel_opaque (line 914)";
static char __pyx_k_66[] = "GLDraw.get_half (line 954)";
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__gl[] = "gl";
static char __pyx_k__os[] = "os";
static char __pyx_k__xo[] = "xo";
static char __pyx_k__yo[] = "yo";
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__set[] = "set";
static char __pyx_k__xdx[] = "xdx";
static char __pyx_k__xdy[] = "xdy";
static char __pyx_k__ydx[] = "ydx";
static char __pyx_k__ydy[] = "ydy";
static char __pyx_k__Info[] = "Info";
static char __pyx_k__clip[] = "clip";
static char __pyx_k__copy[] = "copy";
static char __pyx_k__core[] = "core";
static char __pyx_k__flip[] = "flip";
static char __pyx_k__game[] = "game";
static char __pyx_k__info[] = "info";
static char __pyx_k__init[] = "init";
static char __pyx_k__kill[] = "kill";
static char __pyx_k__mark[] = "mark";
static char __pyx_k__quit[] = "quit";
static char __pyx_k__surf[] = "surf";
static char __pyx_k__time[] = "time";
static char __pyx_k__what[] = "what";
static char __pyx_k__alpha[] = "alpha";
static char __pyx_k__array[] = "array";
static char __pyx_k__audio[] = "audio";
static char __pyx_k__clear[] = "clear";
static char __pyx_k__error[] = "error";
static char __pyx_k__fixed[] = "fixed";
static char __pyx_k__modal[] = "modal";
static char __pyx_k__mouse[] = "mouse";
static char __pyx_k__movie[] = "movie";
static char __pyx_k__music[] = "music";
static char __pyx_k__pitch[] = "pitch";
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__FboRtt[] = "FboRtt";
static char __pyx_k__GLDraw[] = "GLDraw";
static char __pyx_k__OPENGL[] = "OPENGL";
static char __pyx_k__config[] = "config";
static char __pyx_k__deinit[] = "deinit";
static char __pyx_k__envval[] = "envval";
static char __pyx_k__envvar[] = "envvar";
static char __pyx_k__height[] = "height";
static char __pyx_k__module[] = "module";
static char __pyx_k__number[] = "number";
static char __pyx_k__opaque[] = "opaque";
static char __pyx_k__pixels[] = "pixels";
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__window[] = "window";
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__focuses[] = "focuses";
static char __pyx_k__forward[] = "forward";
static char __pyx_k__get_pos[] = "get_pos";
static char __pyx_k__getattr[] = "getattr";
static char __pyx_k__gl_size[] = "gl_size";
static char __pyx_k__limited[] = "limited";
static char __pyx_k__opygame[] = "opygame";
static char __pyx_k__parents[] = "parents";
static char __pyx_k__reverse[] = "reverse";
static char __pyx_k__surface[] = "surface";
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__children[] = "children";
static char __pyx_k__clipping[] = "clipping";
static char __pyx_k__cpu_idle[] = "cpu_idle";
static char __pyx_k__did_init[] = "did_init";
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__RESIZABLE[] = "RESIZABLE";
static char __pyx_k__current_h[] = "current_h";
static char __pyx_k__current_w[] = "current_w";
static char __pyx_k__draw_func[] = "draw_func";
static char __pyx_k__free_list[] = "free_list";
static char __pyx_k__gl_enable[] = "gl_enable";
static char __pyx_k__glenviron[] = "glenviron";
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__operation[] = "operation";
static char __pyx_k__post_init[] = "post_init";
static char __pyx_k__render_of[] = "render_of";
static char __pyx_k__transform[] = "transform";
static char __pyx_k__transient[] = "transient";
static char __pyx_k__FULLSCREEN[] = "FULLSCREEN";
static char __pyx_k__clip_cache[] = "clip_cache";
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__generation[] = "generation";
static char __pyx_k__glrtt_copy[] = "glrtt_copy";
static char __pyx_k__half_cache[] = "half_cache";
static char __pyx_k__layer_name[] = "layer_name";
static char __pyx_k__mouse_info[] = "mouse_info";
static char __pyx_k__startswith[] = "startswith";
static char __pyx_k__subsurface[] = "subsurface";
static char __pyx_k__ImportError[] = "ImportError";
static char __pyx_k__draw_screen[] = "draw_screen";
static char __pyx_k__free_memory[] = "free_memory";
static char __pyx_k__get_playing[] = "get_playing";
static char __pyx_k__non_aligned[] = "non_aligned";
static char __pyx_k__set_visible[] = "set_visible";
static char __pyx_k__virtual_box[] = "virtual_box";
static char __pyx_k__RENPY_GL_RTT[] = "RENPY_GL_RTT";
static char __pyx_k__cache_killed[] = "cache_killed";
static char __pyx_k__clip_rtt_box[] = "clip_rtt_box";
static char __pyx_k__display_info[] = "display_info";
static char __pyx_k__load_texture[] = "load_texture";
static char __pyx_k__needs_redraw[] = "needs_redraw";
static char __pyx_k__pass_focuses[] = "pass_focuses";
static char __pyx_k__physical_box[] = "physical_box";
static char __pyx_k__virtual_size[] = "virtual_size";
static char __pyx_k__GL_ALPHA_SIZE[] = "GL_ALPHA_SIZE";
static char __pyx_k__IMAGEDISSOLVE[] = "IMAGEDISSOLVE";
static char __pyx_k__ShaderEnviron[] = "ShaderEnviron";
static char __pyx_k__alpha_surface[] = "alpha_surface";
static char __pyx_k__always_opaque[] = "always_opaque";
static char __pyx_k__clip_mode_rtt[] = "clip_mode_rtt";
static char __pyx_k__fast_dissolve[] = "fast_dissolve";
static char __pyx_k__flip_unscaled[] = "flip_unscaled";
static char __pyx_k__physical_size[] = "physical_size";
static char __pyx_k__redraw_period[] = "redraw_period";
static char __pyx_k__should_redraw[] = "should_redraw";
static char __pyx_k__texture_cache[] = "texture_cache";
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__old_fullscreen[] = "old_fullscreen";
static char __pyx_k__set_rgba_masks[] = "set_rgba_masks";
static char __pyx_k__upscale_factor[] = "upscale_factor";
static char __pyx_k__GL_SWAP_CONTROL[] = "GL_SWAP_CONTROL";
static char __pyx_k__depends_on_list[] = "depends_on_list";
static char __pyx_k__glenviron_fixed[] = "glenviron_fixed";
static char __pyx_k__is_pixel_opaque[] = "is_pixel_opaque";
static char __pyx_k__operation_alpha[] = "operation_alpha";
static char __pyx_k__translate_mouse[] = "translate_mouse";
static char __pyx_k__RENPY_GL_ENVIRON[] = "RENPY_GL_ENVIRON";
static char __pyx_k__clip_mode_screen[] = "clip_mode_screen";
static char __pyx_k__dealloc_textures[] = "dealloc_textures";
static char __pyx_k__draw_transformed[] = "draw_transformed";
static char __pyx_k__fullscreen_video[] = "fullscreen_video";
static char __pyx_k__gl_set_attribute[] = "gl_set_attribute";
static char __pyx_k__glenviron_shader[] = "glenviron_shader";
static char __pyx_k__last_redraw_time[] = "last_redraw_time";
static char __pyx_k__surface_unscaled[] = "surface_unscaled";
static char __pyx_k__visible_children[] = "visible_children";
static char __pyx_k__WeakKeyDictionary[] = "WeakKeyDictionary";
static char __pyx_k__get_movie_texture[] = "get_movie_texture";
static char __pyx_k__glenviron_limited[] = "glenviron_limited";
static char __pyx_k__mouse_old_visible[] = "mouse_old_visible";
static char __pyx_k__render_to_texture[] = "render_to_texture";
static char __pyx_k__fullscreen_surface[] = "fullscreen_surface";
static char __pyx_k__operation_complete[] = "operation_complete";
static char __pyx_k__operation_parameter[] = "operation_parameter";
static char __pyx_k__use_clipping_planes[] = "use_clipping_planes";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_16;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_18;
static PyObject *__pyx_kp_s_19;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_21;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_n_s_23;
static PyObject *__pyx_n_s_24;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_26;
static PyObject *__pyx_n_s_27;
static PyObject *__pyx_n_s_28;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_n_s_30;
static PyObject *__pyx_n_s_31;
static PyObject *__pyx_kp_s_32;
static PyObject *__pyx_n_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_35;
static PyObject *__pyx_n_s_36;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_38;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_n_s_40;
static PyObject *__pyx_n_s_41;
static PyObject *__pyx_kp_s_42;
static PyObject *__pyx_n_s_43;
static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_n_s_45;
static PyObject *__pyx_n_s_46;
static PyObject *__pyx_n_s_47;
static PyObject *__pyx_n_s_48;
static PyObject *__pyx_n_s_49;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_n_s_50;
static PyObject *__pyx_n_s_51;
static PyObject *__pyx_n_s_52;
static PyObject *__pyx_n_s_53;
static PyObject *__pyx_kp_s_54;
static PyObject *__pyx_kp_s_55;
static PyObject *__pyx_kp_s_56;
static PyObject *__pyx_kp_u_57;
static PyObject *__pyx_kp_u_58;
static PyObject *__pyx_kp_u_59;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_u_60;
static PyObject *__pyx_kp_u_61;
static PyObject *__pyx_kp_u_62;
static PyObject *__pyx_kp_u_63;
static PyObject *__pyx_kp_u_64;
static PyObject *__pyx_kp_u_65;
static PyObject *__pyx_kp_u_66;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_9;
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__GLDraw;
static PyObject *__pyx_n_s__GLError;
static PyObject *__pyx_n_s__GL_ALPHA_SIZE;
static PyObject *__pyx_n_s__GL_SWAP_CONTROL;
static PyObject *__pyx_n_s__IDENTITY;
static PyObject *__pyx_n_s__IMAGEDISSOLVE;
static PyObject *__pyx_n_s__ImportError;
static PyObject *__pyx_n_s__Info;
static PyObject *__pyx_n_s__LimitedEnviron;
static PyObject *__pyx_n_s__Matrix2D;
static PyObject *__pyx_n_s__OPENGL;
static PyObject *__pyx_n_s__PIXELLATE;
static PyObject *__pyx_n_s__RENPY_GL_ENVIRON;
static PyObject *__pyx_n_s__RENPY_GL_RTT;
static PyObject *__pyx_n_s__RENPY_GL_VSYNC;
static PyObject *__pyx_n_s__RESIZABLE;
static PyObject *__pyx_n_s__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__alpha;
static PyObject *__pyx_n_s__alpha_surface;
static PyObject *__pyx_n_s__always_opaque;
static PyObject *__pyx_n_s__android;
static PyObject *__pyx_n_s__array;
static PyObject *__pyx_n_s__audio;
static PyObject *__pyx_n_s__cache_killed;
static PyObject *__pyx_n_s__children;
static PyObject *__pyx_n_s__clear;
static PyObject *__pyx_n_s__clip;
static PyObject *__pyx_n_s__clip_cache;
static PyObject *__pyx_n_s__clip_mode_rtt;
static PyObject *__pyx_n_s__clip_mode_screen;
static PyObject *__pyx_n_s__clip_rtt_box;
static PyObject *__pyx_n_s__clipping;
static PyObject *__pyx_n_s__config;
static PyObject *__pyx_n_s__copy;
static PyObject *__pyx_n_s__core;
static PyObject *__pyx_n_s__cpu_idle;
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__depends_on_list;
static PyObject *__pyx_n_s__did_init;
static PyObject *__pyx_n_s__display;
static PyObject *__pyx_n_s__display_info;
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__fast_dissolve;
static PyObject *__pyx_n_s__fbo;
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__focuses;
static PyObject *__pyx_n_s__forward;
static PyObject *__pyx_n_s__free_list;
static PyObject *__pyx_n_s__free_memory;
static PyObject *__pyx_n_s__fullscreen;
static PyObject *__pyx_n_s__fullscreen_surface;
static PyObject *__pyx_n_s__fullscreen_video;
static PyObject *__pyx_n_s__game;
static PyObject *__pyx_n_s__generation;
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_movie_texture;
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__getattr;
static PyObject *__pyx_n_s__gl;
static PyObject *__pyx_n_s__gl_enable;
static PyObject *__pyx_n_s__gl_set_attribute;
static PyObject *__pyx_n_s__gl_size;
static PyObject *__pyx_n_s__glenviron;
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__info;
static PyObject *__pyx_n_s__init;
static PyObject *__pyx_n_s__interface;
static PyObject *__pyx_n_s__is_opaque;
static PyObject *__pyx_n_s__is_pixel_opaque;
static PyObject *__pyx_n_s__kill;
static PyObject *__pyx_n_s__last_redraw_time;
static PyObject *__pyx_n_s__layer_name;
static PyObject *__pyx_n_s__limited;
static PyObject *__pyx_n_s__load_texture;
static PyObject *__pyx_n_s__log;
static PyObject *__pyx_n_s__mark;
static PyObject *__pyx_n_s__modal;
static PyObject *__pyx_n_s__module;
static PyObject *__pyx_n_s__mouse;
static PyObject *__pyx_n_s__mouse_info;
static PyObject *__pyx_n_s__mouse_old_visible;
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__number;
static PyObject *__pyx_n_s__old_fullscreen;
static PyObject *__pyx_n_s__opaque;
static PyObject *__pyx_n_s__operation;
static PyObject *__pyx_n_s__operation_alpha;
static PyObject *__pyx_n_s__operation_complete;
static PyObject *__pyx_n_s__operation_parameter;
static PyObject *__pyx_n_s__opygame;
static PyObject *__pyx_n_s__os;
static PyObject *__pyx_n_s__parents;
static PyObject *__pyx_n_s__pass_focuses;
static PyObject *__pyx_n_s__pgrender;
static PyObject *__pyx_n_s__physical_box;
static PyObject *__pyx_n_s__physical_size;
static PyObject *__pyx_n_s__pitch;
static PyObject *__pyx_n_s__pixels;
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__redraw_period;
static PyObject *__pyx_n_s__render;
static PyObject *__pyx_n_s__render_of;
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__reverse;
static PyObject *__pyx_n_s__rtt;
static PyObject *__pyx_n_s__set;
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__should_redraw;
static PyObject *__pyx_n_s__sorted;
static PyObject *__pyx_n_s__split;
static PyObject *__pyx_n_s__startswith;
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__texture_cache;
static PyObject *__pyx_n_s__time;
static PyObject *__pyx_n_s__transform;
static PyObject *__pyx_n_s__transient;
static PyObject *__pyx_n_s__translate_mouse;
static PyObject *__pyx_n_s__upscale_factor;
static PyObject *__pyx_n_s__use_clipping_planes;
static PyObject *__pyx_n_s__use_gles;
static PyObject *__pyx_n_s__video;
static PyObject *__pyx_n_s__virtual_box;
static PyObject *__pyx_n_s__virtual_size;
static PyObject *__pyx_n_s__visible_children;
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__window;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xdx;
static PyObject *__pyx_n_s__xdy;
static PyObject *__pyx_n_s__xo;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__ydx;
static PyObject *__pyx_n_s__ydy;
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_8;
static PyObject *__pyx_int_102;
static PyObject *__pyx_int_255;
static PyObject *__pyx_k_39;

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":87
 * IDENTITY = renpy.display.render.IDENTITY
 * 
 * cdef void gl_clip(GLenum plane, GLdouble a, GLdouble b, GLdouble c, GLdouble d):             # <<<<<<<<<<<<<<
 *     """
 *     Utility function that takes care of setting up an OpenGL clip plane.
 */

static  void __pyx_f_5renpy_7display_6gldraw_gl_clip(GLenum __pyx_v_plane, GLdouble __pyx_v_a, GLdouble __pyx_v_b, GLdouble __pyx_v_c, GLdouble __pyx_v_d) {
  GLdouble __pyx_v_equation[4];
  __Pyx_RefNannySetupContext("gl_clip");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":94
 *     cdef GLdouble equation[4]
 * 
 *     equation[0] = a             # <<<<<<<<<<<<<<
 *     equation[1] = b
 *     equation[2] = c
 */
  (__pyx_v_equation[0]) = __pyx_v_a;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":95
 * 
 *     equation[0] = a
 *     equation[1] = b             # <<<<<<<<<<<<<<
 *     equation[2] = c
 *     equation[3] = d
 */
  (__pyx_v_equation[1]) = __pyx_v_b;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":96
 *     equation[0] = a
 *     equation[1] = b
 *     equation[2] = c             # <<<<<<<<<<<<<<
 *     equation[3] = d
 *     glClipPlane(plane, equation)
 */
  (__pyx_v_equation[2]) = __pyx_v_c;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":97
 *     equation[1] = b
 *     equation[2] = c
 *     equation[3] = d             # <<<<<<<<<<<<<<
 *     glClipPlane(plane, equation)
 * 
 */
  (__pyx_v_equation[3]) = __pyx_v_d;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":98
 *     equation[2] = c
 *     equation[3] = d
 *     glClipPlane(plane, equation)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  glClipPlane(__pyx_v_plane, __pyx_v_equation);

  __Pyx_RefNannyFinishContext();
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":101
 * 
 * 
 * cdef int round(double d):             # <<<<<<<<<<<<<<
 *     return <int> (d + .5)
 * 
 */

static  int __pyx_f_5renpy_7display_6gldraw_round(double __pyx_v_d) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("round");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":102
 * 
 * cdef int round(double d):
 *     return <int> (d + .5)             # <<<<<<<<<<<<<<
 * 
 * # A list of cards that cause system/software crashes. There's no
 */
  __pyx_r = ((int)(__pyx_v_d + .5));
  goto __pyx_L0;

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":116
 * cdef class GLDraw:
 * 
 *     def __init__(self):             # <<<<<<<<<<<<<<
 * 
 *         # Did we do the first-time init?
 */

static int __pyx_pf_5renpy_7display_6gldraw_6GLDraw___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pf_5renpy_7display_6gldraw_6GLDraw___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("__init__");
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":119
 * 
 *         # Did we do the first-time init?
 *         self.did_init = False             # <<<<<<<<<<<<<<
 * 
 *         # The GL environment to use.
 */
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->did_init = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":122
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":125
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":128
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->window);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":131
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size = ((PyObject *)Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":134
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size = ((PyObject *)Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":137
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":140
 * 
 *         # 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_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":143
 * 
 *         # 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 = 143; __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 = 143; __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 = 143; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":146
 * 
 *         # The time of the last redraw.
 *         self.last_redraw_time = 0             # <<<<<<<<<<<<<<
 * 
 *         # The time between redraws.
 */
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->last_redraw_time = 0.0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":149
 * 
 *         # The time between redraws.
 *         self.redraw_period = .2             # <<<<<<<<<<<<<<
 * 
 *         # Info.
 */
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->redraw_period = .2;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":152
 * 
 *         # Info.
 *         self.info = { "renderer" : "gl" }             # <<<<<<<<<<<<<<
 * 
 *         # Old value of fullscreen.
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__renderer), ((PyObject *)__pyx_n_s__gl)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":155
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":159
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":162
 * 
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":165
 * 
 *         # The amount we're upscaling by.
 *         self.upscale_factor = 1.0             # <<<<<<<<<<<<<<
 * 
 *         # Should we use the fast (but incorrect) dissolve mode?
 */
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->upscale_factor = 1.0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":168
 * 
 *         # Should we use the fast (but incorrect) dissolve mode?
 *         self.fast_dissolve = False # renpy.android             # <<<<<<<<<<<<<<
 * 
 *         # Should we use clipping planes or stencils?
 */
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->fast_dissolve = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":171
 * 
 *         # Should we use clipping planes or stencils?
 *         self.use_clipping_planes = True             # <<<<<<<<<<<<<<
 * 
 *         # Should we always report pixels as being always opaque?
 */
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->use_clipping_planes = 1;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":174
 * 
 *         # Should we always report pixels as being always opaque?
 *         self.always_opaque = renpy.android             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __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 = 174; __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 = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->always_opaque = __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.display.gldraw.GLDraw.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":177
 * 
 * 
 *     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_7display_6gldraw_6GLDraw_set_mode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_set_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_7display_6gldraw_6GLDraw_set_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;
  PyObject *__pyx_v_vwidth;
  PyObject *__pyx_v_vheight;
  PyObject *__pyx_v_pwidth;
  PyObject *__pyx_v_pheight;
  PyObject *__pyx_v_virtual_ar;
  PyObject *__pyx_v_vsync;
  PyObject *__pyx_v_e;
  PyObject *__pyx_v_physical_ar;
  PyObject *__pyx_v_x_padding;
  PyObject *__pyx_v_y_padding;
  PyObject *__pyx_v_px_padding;
  PyObject *__pyx_v_py_padding;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  long __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__virtual_size,&__pyx_n_s__physical_size,&__pyx_n_s__fullscreen,0};
  __Pyx_RefNannySetupContext("set_mode");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    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 = 177; __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 = 177; __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 = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_virtual_size = values[0];
    __pyx_v_physical_size = values[1];
    __pyx_v_fullscreen = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_virtual_size = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_physical_size = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_fullscreen = PyTuple_GET_ITEM(__pyx_args, 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 = 177; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.set_mode");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_fullscreen);
  __pyx_v_vwidth = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vheight = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_pwidth = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_pheight = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_virtual_ar = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vsync = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_physical_ar = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_x_padding = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_y_padding = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_px_padding = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_py_padding = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":184
 *         """
 * 
 *         if not renpy.config.gl_enable:             # <<<<<<<<<<<<<<
 *             renpy.log.info("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 = 184; __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 = 184; __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 = 184; __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 = 184; __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) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":185
 * 
 *         if not renpy.config.gl_enable:
 *             renpy.log.info("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 = 185; __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[0]; __pyx_lineno = 185; __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 = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
    __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":186
 *         if not renpy.config.gl_enable:
 *             renpy.log.info("GL Disabled.")
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         if self.did_init:
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); 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_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":188
 *             return False
 * 
 *         if self.did_init:             # <<<<<<<<<<<<<<
 *             self.deinit()
 * 
 */
  if (((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->did_init) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":189
 * 
 *         if self.did_init:
 *             self.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if renpy.android:
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__deinit); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":191
 *             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 = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__android); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":192
 * 
 *         if renpy.android:
 *             fullscreen = False             # <<<<<<<<<<<<<<
 * 
 *         if fullscreen != self.old_fullscreen:
 */
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); 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_v_fullscreen);
    __pyx_v_fullscreen = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":194
 *             fullscreen = False
 * 
 *         if fullscreen != self.old_fullscreen:             # <<<<<<<<<<<<<<
 * 
 *             if self.old_fullscreen is not None:
 */
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_fullscreen, ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen, Py_NE); 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_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_4) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":196
 *         if fullscreen != self.old_fullscreen:
 * 
 *             if self.old_fullscreen is not None:             # <<<<<<<<<<<<<<
 *                 pygame.display.quit()
 * 
 */
    __pyx_t_4 = (((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen != Py_None);
    if (__pyx_t_4) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":197
 * 
 *             if self.old_fullscreen is not None:
 *                 pygame.display.quit()             # <<<<<<<<<<<<<<
 * 
 *             pygame.display.init()
 */
      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); 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 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__display); 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_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__quit); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":199
 *                 pygame.display.quit()
 * 
 *             pygame.display.init()             # <<<<<<<<<<<<<<
 * 
 *             self.display_info = pygame.display.Info()
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __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__init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":201
 *             pygame.display.init()
 * 
 *             self.display_info = pygame.display.Info()             # <<<<<<<<<<<<<<
 * 
 *             renpy.display.interface.post_init()
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__display); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__Info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info);
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":203
 *             self.display_info = pygame.display.Info()
 * 
 *             renpy.display.interface.post_init()             # <<<<<<<<<<<<<<
 * 
 *             self.old_fullscreen = fullscreen
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); 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(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__interface); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__post_init); 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(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":205
 *             renpy.display.interface.post_init()
 * 
 *             self.old_fullscreen = fullscreen             # <<<<<<<<<<<<<<
 * 
 *         renpy.log.info("")
 */
    __Pyx_INCREF(__pyx_v_fullscreen);
    __Pyx_GIVEREF(__pyx_v_fullscreen);
    __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen);
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen = __pyx_v_fullscreen;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":207
 *             self.old_fullscreen = fullscreen
 * 
 *         renpy.log.info("")             # <<<<<<<<<<<<<<
 * 
 *         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 = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":209
 *         renpy.log.info("")
 * 
 *         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 = 209; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size = ((PyObject *)__pyx_v_virtual_size);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":211
 *         self.virtual_size = virtual_size
 * 
 *         vwidth, vheight = virtual_size             # <<<<<<<<<<<<<<
 *         pwidth, pheight = physical_size
 *         virtual_ar = 1.0 * vwidth / vheight
 */
  if (PyTuple_CheckExact(__pyx_v_virtual_size) && likely(PyTuple_GET_SIZE(__pyx_v_virtual_size) == 2)) {
    PyObject* tuple = __pyx_v_virtual_size;
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_v_vwidth);
    __pyx_v_vwidth = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_vheight);
    __pyx_v_vheight = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = PyObject_GetIter(__pyx_v_virtual_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_2, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_EndUnpack(__pyx_t_2, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_vwidth);
    __pyx_v_vwidth = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_vheight);
    __pyx_v_vheight = __pyx_t_5;
    __pyx_t_5 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":212
 * 
 *         vwidth, vheight = virtual_size
 *         pwidth, pheight = physical_size             # <<<<<<<<<<<<<<
 *         virtual_ar = 1.0 * vwidth / vheight
 * 
 */
  if (PyTuple_CheckExact(__pyx_v_physical_size) && likely(PyTuple_GET_SIZE(__pyx_v_physical_size) == 2)) {
    PyObject* tuple = __pyx_v_physical_size;
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
    __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_1;
    __pyx_t_1 = 0;
  } else {
    __pyx_t_2 = PyObject_GetIter(__pyx_v_physical_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_2, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_2, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_EndUnpack(__pyx_t_2, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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_1;
    __pyx_t_1 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":213
 *         vwidth, vheight = virtual_size
 *         pwidth, pheight = physical_size
 *         virtual_ar = 1.0 * vwidth / vheight             # <<<<<<<<<<<<<<
 * 
 *         # On a restart, restore the size.
 */
  __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_v_vwidth); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_vheight); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_virtual_ar);
  __pyx_v_virtual_ar = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":216
 * 
 *         # On a restart, restore the size.
 *         if renpy.display.gl_size is not None and not fullscreen:             # <<<<<<<<<<<<<<
 *             pwidth, pheight = renpy.display.gl_size
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__gl_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_4 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_fullscreen); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = (!__pyx_t_3);
    __pyx_t_3 = __pyx_t_6;
  } else {
    __pyx_t_3 = __pyx_t_4;
  }
  if (__pyx_t_3) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":217
 *         # On a restart, restore the size.
 *         if renpy.display.gl_size is not None and not fullscreen:
 *             pwidth, pheight = renpy.display.gl_size             # <<<<<<<<<<<<<<
 * 
 *         pwidth = max(vwidth / 2, pwidth)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__gl_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
      PyObject* tuple = __pyx_t_1;
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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;
    } else {
      __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_7, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      if (__Pyx_EndUnpack(__pyx_t_7, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __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_L11;
  }
  __pyx_L11:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":219
 *             pwidth, pheight = renpy.display.gl_size
 * 
 *         pwidth = max(vwidth / 2, pwidth)             # <<<<<<<<<<<<<<
 *         pheight = max(vheight / 2, pheight)
 * 
 */
  __Pyx_INCREF(__pyx_v_pwidth);
  __pyx_t_1 = __pyx_v_pwidth;
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_vwidth, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_3) {
    __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":220
 * 
 *         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_1 = __Pyx_PyNumber_Divide(__pyx_v_vheight, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_3) {
    __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_INCREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_pheight);
  __pyx_v_pheight = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":222
 *         pheight = max(vheight / 2, pheight)
 * 
 *         if renpy.android:             # <<<<<<<<<<<<<<
 *             pheight = min(self.display_info.current_h, pheight)
 *             pwidth = min(self.display_info.current_w, pwidth)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__android); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_3) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":223
 * 
 *         if renpy.android:
 *             pheight = min(self.display_info.current_h, pheight)             # <<<<<<<<<<<<<<
 *             pwidth = min(self.display_info.current_w, pwidth)
 *         else:
 */
    __Pyx_INCREF(__pyx_v_pheight);
    __pyx_t_5 = __pyx_v_pheight;
    __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_h); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __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 = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {
      __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;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":224
 *         if renpy.android:
 *             pheight = min(self.display_info.current_h, pheight)
 *             pwidth = min(self.display_info.current_w, pwidth)             # <<<<<<<<<<<<<<
 *         else:
 *             pheight = min(self.display_info.current_h - 102, pheight)
 */
    __Pyx_INCREF(__pyx_v_pwidth);
    __pyx_t_1 = __pyx_v_pwidth;
    __pyx_t_5 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_w); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_pwidth);
    __pyx_v_pwidth = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L12;
  }
  /*else*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":226
 *             pwidth = min(self.display_info.current_w, pwidth)
 *         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_2 = __pyx_v_pheight;
    __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_h); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_int_102); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_1 = __pyx_t_2;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_1 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_pheight);
    __pyx_v_pheight = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":227
 *         else:
 *             pheight = min(self.display_info.current_h - 102, pheight)
 *             pwidth = min(self.display_info.current_w - 102, pwidth)             # <<<<<<<<<<<<<<
 * 
 *             # The first time through.
 */
    __Pyx_INCREF(__pyx_v_pwidth);
    __pyx_t_1 = __pyx_v_pwidth;
    __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info, __pyx_n_s__current_w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = PyNumber_Subtract(__pyx_t_2, __pyx_int_102); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_5, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (__pyx_t_3) {
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_2 = __pyx_t_1;
    } else {
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_2 = __pyx_t_5;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_pwidth);
    __pyx_v_pwidth = __pyx_t_2;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":230
 * 
 *             # The first time through.
 *             if not self.did_init:             # <<<<<<<<<<<<<<
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)
 * 
 */
    __pyx_t_3 = (!((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->did_init);
    if (__pyx_t_3) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":231
 *             # The first time through.
 *             if not self.did_init:
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)             # <<<<<<<<<<<<<<
 * 
 *         pwidth = max(pwidth, 256)
 */
      __Pyx_INCREF(__pyx_v_pwidth);
      __pyx_t_2 = __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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_3) {
        __Pyx_INCREF(__pyx_t_2);
        __pyx_t_5 = __pyx_t_2;
      } else {
        __Pyx_INCREF(__pyx_t_1);
        __pyx_t_5 = __pyx_t_1;
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __pyx_t_5;
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_v_pheight);
      __pyx_t_5 = __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 = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_8 = PyObject_RichCompare(__pyx_t_5, __pyx_t_1, Py_LT); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_3) {
        __Pyx_INCREF(__pyx_t_5);
        __pyx_t_7 = __pyx_t_5;
      } 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_5); __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_v_pwidth);
      __pyx_v_pwidth = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_pheight);
      __pyx_v_pheight = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L13;
    }
    __pyx_L13:;
  }
  __pyx_L12:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":233
 *                 pwidth, pheight = min(pheight * virtual_ar, pwidth), min(pwidth / virtual_ar, pheight)
 * 
 *         pwidth = max(pwidth, 256)             # <<<<<<<<<<<<<<
 *         pheight = max(pheight, 256)
 * 
 */
  __pyx_t_9 = 256;
  __Pyx_INCREF(__pyx_v_pwidth);
  __pyx_t_5 = __pyx_v_pwidth;
  __pyx_t_7 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {
    __pyx_t_1 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_INCREF(__pyx_t_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_pwidth);
  __pyx_v_pwidth = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":234
 * 
 *         pwidth = max(pwidth, 256)
 *         pheight = max(pheight, 256)             # <<<<<<<<<<<<<<
 * 
 *         renpy.display.gl_size = None
 */
  __pyx_t_9 = 256;
  __Pyx_INCREF(__pyx_v_pheight);
  __pyx_t_2 = __pyx_v_pheight;
  __pyx_t_1 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_3) {
    __pyx_t_7 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = __pyx_t_7;
    __pyx_t_7 = 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_pheight);
  __pyx_v_pheight = __pyx_t_5;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":236
 *         pheight = max(pheight, 256)
 * 
 *         renpy.display.gl_size = None             # <<<<<<<<<<<<<<
 * 
 *         # Handle swap control.
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (PyObject_SetAttr(__pyx_t_2, __pyx_n_s__gl_size, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":239
 * 
 *         # Handle swap control.
 *         vsync = os.environ.get("RENPY_GL_VSYNC", "1")             # <<<<<<<<<<<<<<
 *         pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, int(vsync))
 *         pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__os); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __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 = 239; __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 = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__RENPY_GL_VSYNC));
  PyTuple_SET_ITEM(__pyx_t_5, 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_t_5, 1, ((PyObject *)__pyx_kp_s__1));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s__1));
  __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_vsync);
  __pyx_v_vsync = __pyx_t_7;
  __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":240
 *         # Handle swap control.
 *         vsync = os.environ.get("RENPY_GL_VSYNC", "1")
 *         pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, int(vsync))             # <<<<<<<<<<<<<<
 *         pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 * 
 */
  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 240; __pyx_clineno = __LINE__; goto __pyx_L1_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__gl_set_attribute); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__GL_SWAP_CONTROL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_vsync);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_vsync);
  __Pyx_GIVEREF(__pyx_v_vsync);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __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(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":241
 *         vsync = os.environ.get("RENPY_GL_VSYNC", "1")
 *         pygame.display.gl_set_attribute(pygame.GL_SWAP_CONTROL, int(vsync))
 *         pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)             # <<<<<<<<<<<<<<
 * 
 *         try:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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__gl_set_attribute); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__GL_ALPHA_SIZE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_int_8);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_8);
  __Pyx_GIVEREF(__pyx_int_8);
  __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":243
 *         pygame.display.gl_set_attribute(pygame.GL_ALPHA_SIZE, 8)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             if fullscreen:
 *                 renpy.log.info("Fullscreen mode.")
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":244
 * 
 *         try:
 *             if fullscreen:             # <<<<<<<<<<<<<<
 *                 renpy.log.info("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | pygame.OPENGL | pygame.DOUBLEBUF)
 */
      __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_fullscreen); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
      if (__pyx_t_3) {

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":245
 *         try:
 *             if fullscreen:
 *                 renpy.log.info("Fullscreen mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | pygame.OPENGL | pygame.DOUBLEBUF)
 *             else:
 */
        __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L14_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__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __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 = 245; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
        PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_3));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
        __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":246
 *             if fullscreen:
 *                 renpy.log.info("Fullscreen mode.")
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | pygame.OPENGL | pygame.DOUBLEBUF)             # <<<<<<<<<<<<<<
 *             else:
 *                 renpy.log.info("Windowed mode.")
 */
        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_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_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        __Pyx_INCREF(__pyx_int_0);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
        __Pyx_GIVEREF(__pyx_int_0);
        __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__FULLSCREEN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__OPENGL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Or(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__DOUBLEBUF); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyNumber_Or(__pyx_t_7, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_8);
        __pyx_t_5 = 0;
        __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_GIVEREF(__pyx_t_8);
        __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window);
        __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window);
        ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window = __pyx_t_8;
        __pyx_t_8 = 0;
        goto __pyx_L22;
      }
      /*else*/ {

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":248
 *                 self.window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN | pygame.OPENGL | pygame.DOUBLEBUF)
 *             else:
 *                 renpy.log.info("Windowed mode.")             # <<<<<<<<<<<<<<
 *                 self.window = pygame.display.set_mode((pwidth, pheight), pygame.RESIZABLE | pygame.OPENGL | pygame.DOUBLEBUF)
 * 
 */
        __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __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 = 248; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
        PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_4));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
        __pyx_t_1 = PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":249
 *             else:
 *                 renpy.log.info("Windowed mode.")
 *                 self.window = pygame.display.set_mode((pwidth, pheight), pygame.RESIZABLE | pygame.OPENGL | pygame.DOUBLEBUF)             # <<<<<<<<<<<<<<
 * 
 *         except pygame.error, e:
 */
        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_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_L14_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__set_mode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_pwidth);
        PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pwidth);
        __Pyx_GIVEREF(__pyx_v_pwidth);
        __Pyx_INCREF(__pyx_v_pheight);
        PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_pheight);
        __Pyx_GIVEREF(__pyx_v_pheight);
        __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__RESIZABLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__OPENGL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __pyx_t_8 = PyNumber_Or(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__DOUBLEBUF); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyNumber_Or(__pyx_t_8, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_5);
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __pyx_t_2 = 0;
        __pyx_t_7 = 0;
        __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L14_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_GIVEREF(__pyx_t_7);
        __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window);
        __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window);
        ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window = __pyx_t_7;
        __pyx_t_7 = 0;
      }
      __pyx_L22:;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L21_try_end;
    __pyx_L14_error:;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":251
 *                 self.window = pygame.display.set_mode((pwidth, pheight), pygame.RESIZABLE | pygame.OPENGL | pygame.DOUBLEBUF)
 * 
 *         except pygame.error, e:             # <<<<<<<<<<<<<<
 *             renpy.log.info("Could not get pygame screen: %r", e)
 * 
 */
    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_10) {
      __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.set_mode");
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_7, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_v_e);
      __pyx_v_e = __pyx_t_7;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":252
 * 
 *         except pygame.error, e:
 *             renpy.log.info("Could not get pygame screen: %r", e)             # <<<<<<<<<<<<<<
 * 
 *             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 = 252; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __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 = 252; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
      PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_5));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
      __Pyx_INCREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      __pyx_t_11 = PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":254
 *             renpy.log.info("Could not get pygame screen: %r", e)
 * 
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         pwidth, pheight = self.window.get_size()
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L16_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_r = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L17_except_return;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L15_exception_handled;
    }
    __pyx_L16_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L17_except_return:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L0;
    __pyx_L15_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L21_try_end:;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":256
 *             return False
 * 
 *         pwidth, pheight = self.window.get_size()             # <<<<<<<<<<<<<<
 *         self.physical_size = (pwidth, pheight)
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->window, __pyx_n_s__get_size); 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_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyTuple_CheckExact(__pyx_t_7) && likely(PyTuple_GET_SIZE(__pyx_t_7) == 2)) {
    PyObject* tuple = __pyx_t_7;
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_v_pwidth);
    __pyx_v_pwidth = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_pheight);
    __pyx_v_pheight = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __pyx_t_11 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_11, 0); 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_5 = __Pyx_UnpackItem(__pyx_t_11, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_EndUnpack(__pyx_t_11, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_v_pwidth);
    __pyx_v_pwidth = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_pheight);
    __pyx_v_pheight = __pyx_t_5;
    __pyx_t_5 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":257
 * 
 *         pwidth, pheight = self.window.get_size()
 *         self.physical_size = (pwidth, pheight)             # <<<<<<<<<<<<<<
 * 
 *         renpy.log.info("Screen sizes: virtual=%r physical=%r" % (self.virtual_size, self.physical_size))
 */
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_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);
  if (!(likely(PyTuple_CheckExact(__pyx_t_7))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_7);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size = ((PyObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":259
 *         self.physical_size = (pwidth, pheight)
 * 
 *         renpy.log.info("Screen sizes: virtual=%r physical=%r" % (self.virtual_size, self.physical_size))             # <<<<<<<<<<<<<<
 * 
 *         pwidth = max(1, pwidth)
 */
  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_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__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__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 = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":261
 *         renpy.log.info("Screen sizes: virtual=%r physical=%r" % (self.virtual_size, self.physical_size))
 * 
 *         pwidth = max(1, pwidth)             # <<<<<<<<<<<<<<
 *         pheight = max(1, pheight)
 * 
 */
  __Pyx_INCREF(__pyx_v_pwidth);
  __pyx_t_1 = __pyx_v_pwidth;
  __pyx_t_9 = 1;
  __pyx_t_7 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_11 = PyObject_RichCompare(__pyx_t_1, __pyx_t_7, Py_GT); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_t_1);
    __pyx_t_5 = __pyx_t_1;
  } else {
    __pyx_t_11 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_5 = __pyx_t_11;
    __pyx_t_11 = 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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":262
 * 
 *         pwidth = max(1, pwidth)
 *         pheight = max(1, pheight)             # <<<<<<<<<<<<<<
 * 
 *         # Figure out the virtual box, which includes padding around
 */
  __Pyx_INCREF(__pyx_v_pheight);
  __pyx_t_5 = __pyx_v_pheight;
  __pyx_t_9 = 1;
  __pyx_t_11 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_5, __pyx_t_11, Py_GT); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_3) {
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
  } else {
    __pyx_t_7 = PyInt_FromLong(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __pyx_t_7;
    __pyx_t_7 = 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;

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":268
 *         physical_ar = 1.0 * pwidth / pheight
 * 
 *         if physical_ar >= virtual_ar:             # <<<<<<<<<<<<<<
 *             x_padding = physical_ar * vheight - vwidth
 *             y_padding = 0
 */
  __pyx_t_1 = PyObject_RichCompare(__pyx_v_physical_ar, __pyx_v_virtual_ar, Py_GE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __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 = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":269
 * 
 *         if physical_ar >= virtual_ar:
 *             x_padding = physical_ar * vheight - vwidth             # <<<<<<<<<<<<<<
 *             y_padding = 0
 *             px_padding = x_padding * pheight / vheight
 */
    __pyx_t_1 = PyNumber_Multiply(__pyx_v_physical_ar, __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_t_5 = PyNumber_Subtract(__pyx_t_1, __pyx_v_vwidth); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_x_padding);
    __pyx_v_x_padding = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":270
 *         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_DECREF(__pyx_v_y_padding);
    __pyx_v_y_padding = __pyx_int_0;

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

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":272
 *             y_padding = 0
 *             px_padding = x_padding * pheight / vheight
 *             py_padding = 0             # <<<<<<<<<<<<<<
 *         else:
 *             x_padding = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF(__pyx_v_py_padding);
    __pyx_v_py_padding = __pyx_int_0;
    goto __pyx_L25;
  }
  /*else*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":274
 *             py_padding = 0
 *         else:
 *             x_padding = 0             # <<<<<<<<<<<<<<
 *             y_padding = ( 1.0 / physical_ar ) * vwidth - vheight
 *             px_padding = 0
 */
    __Pyx_INCREF(__pyx_int_0);
    __Pyx_DECREF(__pyx_v_x_padding);
    __pyx_v_x_padding = __pyx_int_0;

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

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":276
 *             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_DECREF(__pyx_v_px_padding);
    __pyx_v_px_padding = __pyx_int_0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":277
 *             y_padding = ( 1.0 / physical_ar ) * vwidth - vheight
 *             px_padding = 0
 *             py_padding = y_padding * pwidth / vwidth             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_5 = PyNumber_Multiply(__pyx_v_y_padding, __pyx_v_pwidth); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_v_vwidth); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_py_padding);
    __pyx_v_py_padding = __pyx_t_1;
    __pyx_t_1 = 0;
  }
  __pyx_L25:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":285
 *         # screen.
 *         self.virtual_box = (
 *             -x_padding / 2.0,             # <<<<<<<<<<<<<<
 *             -y_padding / 2.0,
 *              vwidth + x_padding,
 */
  __pyx_t_1 = PyNumber_Negative(__pyx_v_x_padding); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":286
 *         self.virtual_box = (
 *             -x_padding / 2.0,
 *             -y_padding / 2.0,             # <<<<<<<<<<<<<<
 *              vwidth + x_padding,
 *              vheight + y_padding)
 */
  __pyx_t_5 = PyNumber_Negative(__pyx_v_y_padding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":288
 *             -y_padding / 2.0,
 *              vwidth + x_padding,
 *              vheight + y_padding)             # <<<<<<<<<<<<<<
 * 
 *         # The location of the virtual screen on the physical screen, in
 */
  __pyx_t_5 = PyNumber_Add(__pyx_v_vheight, __pyx_v_y_padding); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_7 = 0;
  __pyx_t_11 = 0;
  __pyx_t_1 = 0;
  __pyx_t_5 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_8))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_8)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":284
 *         # the virtual screen, the corners are often off the virtual
 *         # screen.
 *         self.virtual_box = (             # <<<<<<<<<<<<<<
 *             -x_padding / 2.0,
 *             -y_padding / 2.0,
 */
  __Pyx_GIVEREF(__pyx_t_8);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_box));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_box = ((PyObject *)__pyx_t_8);
  __pyx_t_8 = 0;

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

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

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":297
 *             int(py_padding / 2),
 *             pwidth - int(px_padding),
 *             pheight - int(py_padding),             # <<<<<<<<<<<<<<
 *             )
 * 
 */
  __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_INCREF(__pyx_v_py_padding);
  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_py_padding);
  __Pyx_GIVEREF(__pyx_v_py_padding);
  __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = PyNumber_Subtract(__pyx_v_pheight, __pyx_t_7); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_11);
  __Pyx_GIVEREF(__pyx_t_11);
  __pyx_t_8 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = 0;
  __pyx_t_11 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_7))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_7)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":293
 *         # 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(__pyx_t_7);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box = ((PyObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":300
 *             )
 * 
 *         if not self.did_init:             # <<<<<<<<<<<<<<
 *             if not self.init():
 *                 return False
 */
  __pyx_t_3 = (!((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->did_init);
  if (__pyx_t_3) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":301
 * 
 *         if not self.did_init:
 *             if not self.init():             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
    __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__init); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_11 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __pyx_t_4 = (!__pyx_t_3);
    if (__pyx_t_4) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":302
 *         if not self.did_init:
 *             if not self.init():
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         self.did_init = True
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_11 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_r = __pyx_t_11;
      __pyx_t_11 = 0;
      goto __pyx_L0;
      goto __pyx_L27;
    }
    __pyx_L27:;
    goto __pyx_L26;
  }
  __pyx_L26:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":304
 *                 return False
 * 
 *         self.did_init = True             # <<<<<<<<<<<<<<
 * 
 *         # Set some default settings.
 */
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->did_init = 1;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":307
 * 
 *         # Set some default settings.
 *         glEnable(GL_BLEND)             # <<<<<<<<<<<<<<
 *         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
 * 
 */
  glEnable(GL_BLEND);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":308
 *         # Set some default settings.
 *         glEnable(GL_BLEND)
 *         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)             # <<<<<<<<<<<<<<
 * 
 *         if self.use_clipping_planes:
 */
  glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":310
 *         glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
 * 
 *         if self.use_clipping_planes:             # <<<<<<<<<<<<<<
 *             glEnable(GL_CLIP_PLANE0)
 *             glEnable(GL_CLIP_PLANE1)
 */
  if (((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->use_clipping_planes) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":311
 * 
 *         if self.use_clipping_planes:
 *             glEnable(GL_CLIP_PLANE0)             # <<<<<<<<<<<<<<
 *             glEnable(GL_CLIP_PLANE1)
 *             glEnable(GL_CLIP_PLANE2)
 */
    glEnable(GL_CLIP_PLANE0);

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":312
 *         if self.use_clipping_planes:
 *             glEnable(GL_CLIP_PLANE0)
 *             glEnable(GL_CLIP_PLANE1)             # <<<<<<<<<<<<<<
 *             glEnable(GL_CLIP_PLANE2)
 *             glEnable(GL_CLIP_PLANE3)
 */
    glEnable(GL_CLIP_PLANE1);

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":313
 *             glEnable(GL_CLIP_PLANE0)
 *             glEnable(GL_CLIP_PLANE1)
 *             glEnable(GL_CLIP_PLANE2)             # <<<<<<<<<<<<<<
 *             glEnable(GL_CLIP_PLANE3)
 * 
 */
    glEnable(GL_CLIP_PLANE2);

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":314
 *             glEnable(GL_CLIP_PLANE1)
 *             glEnable(GL_CLIP_PLANE2)
 *             glEnable(GL_CLIP_PLANE3)             # <<<<<<<<<<<<<<
 * 
 *         self.environ.init()
 */
    glEnable(GL_CLIP_PLANE3);
    goto __pyx_L28;
  }
  __pyx_L28:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":316
 *             glEnable(GL_CLIP_PLANE3)
 * 
 *         self.environ.init()             # <<<<<<<<<<<<<<
 *         self.rtt.init()
 * 
 */
  __pyx_t_11 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ, __pyx_n_s__init); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_7 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":317
 * 
 *         self.environ.init()
 *         self.rtt.init()             # <<<<<<<<<<<<<<
 * 
 *         # Prepare a mouse display.
 */
  __pyx_t_7 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt, __pyx_n_s__init); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_11 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":320
 * 
 *         # Prepare a mouse display.
 *         self.mouse_old_visible = None             # <<<<<<<<<<<<<<
 * 
 *         gl_check("set_mode")
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible = Py_None;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":322
 *         self.mouse_old_visible = None
 * 
 *         gl_check("set_mode")             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
  __pyx_t_11 = __pyx_f_5renpy_7display_2gl_gl_check(((PyObject *)__pyx_n_s__set_mode)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":324
 *         gl_check("set_mode")
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 *     def deinit(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_11 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_r = __pyx_t_11;
  __pyx_t_11 = 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_11);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.set_mode");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_vwidth);
  __Pyx_DECREF(__pyx_v_vheight);
  __Pyx_DECREF(__pyx_v_pwidth);
  __Pyx_DECREF(__pyx_v_pheight);
  __Pyx_DECREF(__pyx_v_virtual_ar);
  __Pyx_DECREF(__pyx_v_vsync);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_DECREF(__pyx_v_physical_ar);
  __Pyx_DECREF(__pyx_v_x_padding);
  __Pyx_DECREF(__pyx_v_y_padding);
  __Pyx_DECREF(__pyx_v_px_padding);
  __Pyx_DECREF(__pyx_v_py_padding);
  __Pyx_DECREF(__pyx_v_fullscreen);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":326
 *         return True
 * 
 *     def deinit(self):             # <<<<<<<<<<<<<<
 *         """
 *         De-initializes the system in preparation for a restart, or
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_deinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_deinit[] = "\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_7display_6gldraw_6GLDraw_deinit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  __Pyx_RefNannySetupContext("deinit");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":333
 * 
 *         # This should get rid of all of the cached textures.
 *         renpy.display.render.free_memory()             # <<<<<<<<<<<<<<
 * 
 *         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 = 333; __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 = 333; __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__render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __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__free_memory); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __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 = 333; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":335
 *         renpy.display.render.free_memory()
 * 
 *         self.texture_cache.clear()             # <<<<<<<<<<<<<<
 * 
 *         gltexture.dealloc_textures()
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":337
 *         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 = 337; __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 = 337; __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 = 337; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":339
 *         gltexture.dealloc_textures()
 * 
 *         if self.rtt:             # <<<<<<<<<<<<<<
 *             self.rtt.deinit()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":340
 * 
 *         if self.rtt:
 *             self.rtt.deinit()             # <<<<<<<<<<<<<<
 * 
 *         if self.environ:
 */
    __pyx_t_2 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt, __pyx_n_s__deinit); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __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 = 340; __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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":342
 *             self.rtt.deinit()
 * 
 *         if self.environ:             # <<<<<<<<<<<<<<
 *             self.environ.deinit()
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_3) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":343
 * 
 *         if self.environ:
 *             self.environ.deinit()             # <<<<<<<<<<<<<<
 * 
 *     def quit(self):
 */
    __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ, __pyx_n_s__deinit); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __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 = 343; __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.display.gldraw.GLDraw.deinit");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":345
 *             self.environ.deinit()
 * 
 *     def quit(self):             # <<<<<<<<<<<<<<
 * 
 *         if not self.old_fullscreen:
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_quit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_quit(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("quit");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":347
 *     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_7display_6gldraw_GLDraw *)__pyx_v_self)->old_fullscreen); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":348
 * 
 *         if not self.old_fullscreen:
 *             renpy.display.gl_size = self.physical_size             # <<<<<<<<<<<<<<
 * 
 *         renpy.log.info("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 = 348; __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 = 348; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":350
 *             renpy.display.gl_size = self.physical_size
 * 
 *         renpy.log.info("Deallocating textures.")             # <<<<<<<<<<<<<<
 *         gltexture.dealloc_textures()
 *         renpy.log.info("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 = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __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__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_7));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_7));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7));
  __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":352
 *         renpy.log.info("Deallocating textures.")
 *         gltexture.dealloc_textures()
 *         renpy.log.info("Done deallocating textures.")             # <<<<<<<<<<<<<<
 * 
 *         renpy.log.info("About to quit GL.")
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __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__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_8));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_8));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8));
  __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":354
 *         renpy.log.info("Done deallocating textures.")
 * 
 *         renpy.log.info("About to quit GL.")             # <<<<<<<<<<<<<<
 *         pygame.display.quit()
 *         renpy.log.info("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 = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__log); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __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__info); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
  __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":355
 * 
 *         renpy.log.info("About to quit GL.")
 *         pygame.display.quit()             # <<<<<<<<<<<<<<
 *         renpy.log.info("Finished quit GL.")
 * 
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __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 = 355; __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__quit); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __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_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":356
 *         renpy.log.info("About to quit GL.")
 *         pygame.display.quit()
 *         renpy.log.info("Finished quit GL.")             # <<<<<<<<<<<<<<
 * 
 *     def init(self):
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __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__info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_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 = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
  __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":399
 *             renpy.log.info("    %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_7display_6gldraw_4init_use_subsystem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_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_7display_6gldraw_4init_use_subsystem = {__Pyx_NAMESTR("use_subsystem"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_4init_use_subsystem, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_4init_use_subsystem)};
static PyObject *__pyx_pf_5renpy_7display_6gldraw_4init_use_subsystem(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_7display_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;
  PyObject *__pyx_v_i;
  PyObject *__pyx_r = NULL;
  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;
  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_7display_6gldraw___pyx_scope_struct_init *)__pyx_self;
  __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)); __Pyx_GOTREF(__pyx_v_req_ext);
    if (unlikely(!__pyx_v_req_ext)) return NULL;
  } else {
    __pyx_v_req_ext = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple);
  }
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    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 = 399; __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 = 399; __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 = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_module = values[0];
    __pyx_v_envvar = values[1];
    __pyx_v_envval = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) < 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_module = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_envvar = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_envval = PyTuple_GET_ITEM(__pyx_args, 2);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("use_subsystem", 0, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_DECREF(__pyx_v_req_ext);
  __Pyx_AddTraceback("renpy.display.gldraw.init.use_subsystem");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_value = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":409
 *             """
 * 
 *             if module is None:             # <<<<<<<<<<<<<<
 *                 return False
 * 
 */
  __pyx_t_1 = (__pyx_v_module == Py_None);
  if (__pyx_t_1) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":410
 * 
 *             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 = 410; __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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":412
 *                 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 = 412; __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 = 412; __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 = 412; __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 = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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_2));
  PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_kp_s_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
  __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_value);
  __pyx_v_value = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":413
 * 
 *             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 = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":414
 *             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 = 414; __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 = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_1) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":415
 *             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 = 415; __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*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":417
 *                     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 = 417; __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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":419
 *                     return False
 * 
 *             for i in req_ext:             # <<<<<<<<<<<<<<
 *                 if i not in extensions:
 *                     return False
 */
  if (likely(((PyObject *)__pyx_v_req_ext) != Py_None)) {
    __pyx_t_5 = 0; __pyx_t_4 = ((PyObject *)__pyx_v_req_ext); __Pyx_INCREF(__pyx_t_4);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  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_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":420
 * 
 *             for i in req_ext:
 *                 if i not in extensions:             # <<<<<<<<<<<<<<
 *                     return False
 * 
 */
    __pyx_t_1 = (__Pyx_NegateNonNeg(PySequence_Contains(__pyx_outer_scope->__pyx_v_extensions, __pyx_v_i))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_1) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":421
 *             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 = 421; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":423
 *                     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 = 423; __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.display.gldraw.init.use_subsystem");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_req_ext);
  __Pyx_DECREF(__pyx_v_value);
  __Pyx_DECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":358
 *         renpy.log.info("Finished quit GL.")
 * 
 *     def init(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does the first-time initialization of OpenGL, deciding
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_init[] = "\n        This does the first-time initialization of OpenGL, deciding\n        which subsystems to use.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_init(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *__pyx_cur_scope;
  PyObject *__pyx_v_err;
  PyObject *__pyx_v_renderer;
  PyObject *__pyx_v_version;
  PyObject *__pyx_v_r;
  PyObject *__pyx_v_v;
  PyObject *__pyx_v_extensions_string;
  PyObject *__pyx_v_i;
  PyObject *__pyx_v_use_subsystem;
  GLint __pyx_v_texture_units;
  GLint __pyx_v_clip_planes;
  PyObject *__pyx_v_e;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  GLenum __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  __Pyx_RefNannySetupContext("init");
  __pyx_cur_scope = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *)__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_init->tp_new(__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_init, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_v_err = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_renderer = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_version = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_v = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_extensions_string = Py_None; __Pyx_INCREF(Py_None);
  __pyx_cur_scope->__pyx_v_extensions = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_i = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_use_subsystem = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":365
 * 
 *         # Init glew.
 *         err = glewInit()             # <<<<<<<<<<<<<<
 * 
 *         if err != GLEW_OK:
 */
  __pyx_t_1 = __Pyx_PyInt_to_py_GLenum(glewInit()); 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_v_err);
  __pyx_v_err = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":367
 *         err = glewInit()
 * 
 *         if err != GLEW_OK:             # <<<<<<<<<<<<<<
 *             renpy.log.info("Glew init failed: %s" % <char *> glewGetErrorString(err))
 *             return False
 */
  __pyx_t_1 = PyInt_FromLong(GLEW_OK); 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_RichCompare(__pyx_v_err, __pyx_t_1, Py_NE); 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_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":368
 * 
 *         if err != GLEW_OK:
 *             renpy.log.info("Glew init failed: %s" % <char *> glewGetErrorString(err))             # <<<<<<<<<<<<<<
 *             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 = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __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_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__info); 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_1); __pyx_t_1 = 0;
    __pyx_t_4 = __Pyx_PyInt_from_py_GLenum(__pyx_v_err); if (unlikely((__pyx_t_4 == (GLenum)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_1 = PyBytes_FromString(((char *)glewGetErrorString(__pyx_t_4))); 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_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(((PyObject *)__pyx_t_5));
    __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 = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
    __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":369
 *         if err != GLEW_OK:
 *             renpy.log.info("Glew init failed: %s" % <char *> glewGetErrorString(err))
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         # Log the GL version.
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":372
 * 
 *         # Log the GL version.
 *         renderer = <char *> glGetString(GL_RENDERER)             # <<<<<<<<<<<<<<
 *         version = <char *> glGetString(GL_VERSION)
 * 
 */
  __pyx_t_5 = PyBytes_FromString(((char *)glGetString(GL_RENDERER))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(__pyx_v_renderer);
  __pyx_v_renderer = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":373
 *         # Log the GL version.
 *         renderer = <char *> glGetString(GL_RENDERER)
 *         version = <char *> glGetString(GL_VERSION)             # <<<<<<<<<<<<<<
 * 
 *         renpy.log.info("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 */
  __pyx_t_5 = PyBytes_FromString(((char *)glGetString(GL_VERSION))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_5));
  __Pyx_DECREF(__pyx_v_version);
  __pyx_v_version = ((PyObject *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":375
 *         version = <char *> glGetString(GL_VERSION)
 * 
 *         renpy.log.info("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))             # <<<<<<<<<<<<<<
 *         renpy.log.info("Renderer: %r", renderer)
 *         renpy.log.info("Version: %r", version)
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __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__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __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 = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_1));
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_12));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __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_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":376
 * 
 *         renpy.log.info("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 *         renpy.log.info("Renderer: %r", renderer)             # <<<<<<<<<<<<<<
 *         renpy.log.info("Version: %r", version)
 *         renpy.log.info("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 = 376; __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[0]; __pyx_lineno = 376; __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 = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_13));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
  __Pyx_INCREF(__pyx_v_renderer);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_renderer);
  __Pyx_GIVEREF(__pyx_v_renderer);
  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __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_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":377
 *         renpy.log.info("Vendor: %r", str(<char *> glGetString(GL_VENDOR)))
 *         renpy.log.info("Renderer: %r", renderer)
 *         renpy.log.info("Version: %r", version)             # <<<<<<<<<<<<<<
 *         renpy.log.info("Display Info: %s", self.display_info)
 * 
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_14));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
  __Pyx_INCREF(__pyx_v_version);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_version);
  __Pyx_GIVEREF(__pyx_v_version);
  __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __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_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":378
 *         renpy.log.info("Renderer: %r", renderer)
 *         renpy.log.info("Version: %r", version)
 *         renpy.log.info("Display Info: %s", self.display_info)             # <<<<<<<<<<<<<<
 * 
 *         for r, v in BLACKLIST:
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __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[0]; __pyx_lineno = 378; __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 = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_15));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  PyTuple_SET_ITEM(__pyx_t_2, 1, ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  __Pyx_GIVEREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->display_info);
  __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __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_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":380
 *         renpy.log.info("Display Info: %s", self.display_info)
 * 
 *         for r, v in BLACKLIST:             # <<<<<<<<<<<<<<
 *             if renderer == r and version.startswith(v):
 *                 renpy.log.info("Blacklisted renderer/version.")
 */
  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__BLACKLIST); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2);
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_2))) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_2))) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
    } else {
      __pyx_t_5 = PyIter_Next(__pyx_t_2);
      if (!__pyx_t_5) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
      PyObject* tuple = __pyx_t_5;
      __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
      __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_r);
      __pyx_v_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_7;
      __pyx_t_7 = 0;
    } else {
      __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_v_r);
      __pyx_v_r = __pyx_t_1;
      __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_v_v);
      __pyx_v_v = __pyx_t_7;
      __pyx_t_7 = 0;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":381
 * 
 *         for r, v in BLACKLIST:
 *             if renderer == r and version.startswith(v):             # <<<<<<<<<<<<<<
 *                 renpy.log.info("Blacklisted renderer/version.")
 *                 return False
 */
    __pyx_t_5 = PyObject_RichCompare(__pyx_v_renderer, __pyx_v_r, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_3) {
      __pyx_t_5 = PyObject_GetAttr(__pyx_v_version, __pyx_n_s__startswith); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); 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_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_10 = __pyx_t_9;
    } else {
      __pyx_t_10 = __pyx_t_3;
    }
    if (__pyx_t_10) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":382
 *         for r, v in BLACKLIST:
 *             if renderer == r and version.startswith(v):
 *                 renpy.log.info("Blacklisted renderer/version.")             # <<<<<<<<<<<<<<
 *                 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 = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __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__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_16));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_16));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16));
      __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __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_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":383
 *             if renderer == r and version.startswith(v):
 *                 renpy.log.info("Blacklisted renderer/version.")
 *                 return False             # <<<<<<<<<<<<<<
 * 
 *         if version.startswith("OpenGL ES"):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_r = __pyx_t_5;
      __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":385
 *                 return False
 * 
 *         if version.startswith("OpenGL ES"):             # <<<<<<<<<<<<<<
 *             self.redraw_period = 1.0
 *             self.use_clipping_planes = False
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_version, __pyx_n_s__startswith); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_17));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
  __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_10) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":386
 * 
 *         if version.startswith("OpenGL ES"):
 *             self.redraw_period = 1.0             # <<<<<<<<<<<<<<
 *             self.use_clipping_planes = False
 *             self.always_opaque = True
 */
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->redraw_period = 1.0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":387
 *         if version.startswith("OpenGL ES"):
 *             self.redraw_period = 1.0
 *             self.use_clipping_planes = False             # <<<<<<<<<<<<<<
 *             self.always_opaque = True
 *             gltexture.use_gles()
 */
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->use_clipping_planes = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":388
 *             self.redraw_period = 1.0
 *             self.use_clipping_planes = False
 *             self.always_opaque = True             # <<<<<<<<<<<<<<
 *             gltexture.use_gles()
 * 
 */
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->always_opaque = 1;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":389
 *             self.use_clipping_planes = False
 *             self.always_opaque = True
 *             gltexture.use_gles()             # <<<<<<<<<<<<<<
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 */
    __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__use_gles); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":391
 *             gltexture.use_gles()
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)             # <<<<<<<<<<<<<<
 *         extensions = set(extensions_string.split(" "))
 * 
 */
  __pyx_t_7 = PyBytes_FromString(((char *)glGetString(GL_EXTENSIONS))); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_7));
  __Pyx_DECREF(__pyx_v_extensions_string);
  __pyx_v_extensions_string = ((PyObject *)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":392
 * 
 *         extensions_string = <char *> glGetString(GL_EXTENSIONS)
 *         extensions = set(extensions_string.split(" "))             # <<<<<<<<<<<<<<
 * 
 *         renpy.log.info("Extensions:")
 */
  __pyx_t_7 = PyObject_GetAttr(__pyx_v_extensions_string, __pyx_n_s__split); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_18));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_18));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18));
  __pyx_t_2 = PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __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 = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)&PySet_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_extensions);
  __pyx_cur_scope->__pyx_v_extensions = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":394
 *         extensions = set(extensions_string.split(" "))
 * 
 *         renpy.log.info("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 = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __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__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_19));
  PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_19));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19));
  __pyx_t_7 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":396
 *         renpy.log.info("Extensions:")
 * 
 *         for i in sorted(extensions):             # <<<<<<<<<<<<<<
 *             renpy.log.info("    %s", i)
 * 
 */
  __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_extensions);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_cur_scope->__pyx_v_extensions);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_extensions);
  __pyx_t_5 = PyObject_Call(__pyx_builtin_sorted, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) {
    __pyx_t_6 = 0; __pyx_t_7 = __pyx_t_5; __Pyx_INCREF(__pyx_t_7);
  } else {
    __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  for (;;) {
    if (likely(PyList_CheckExact(__pyx_t_7))) {
      if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_7)) break;
      __pyx_t_5 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
    } else if (likely(PyTuple_CheckExact(__pyx_t_7))) {
      if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_7)) break;
      __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_5); __pyx_t_6++;
    } else {
      __pyx_t_5 = PyIter_Next(__pyx_t_7);
      if (!__pyx_t_5) {
        if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":397
 * 
 *         for i in sorted(extensions):
 *             renpy.log.info("    %s", i)             # <<<<<<<<<<<<<<
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):
 */
    __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __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(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
    PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_20));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
    __Pyx_INCREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __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_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":399
 *             renpy.log.info("    %s", i)
 * 
 *         def use_subsystem(module, envvar, envval, *req_ext):             # <<<<<<<<<<<<<<
 *             """
 *             Decides if we should used a particular subsystem, based on
 */
  __pyx_t_7 = __pyx_binding_PyCFunctionType_New(&__pyx_mdef_5renpy_7display_6gldraw_4init_use_subsystem, ((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_v_use_subsystem);
  __pyx_v_use_subsystem = __pyx_t_7;
  __pyx_t_7 = 0;

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

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":429
 *         glGetIntegerv(GL_MAX_TEXTURE_UNITS, &texture_units)
 * 
 *         renpy.log.info("Number of texture units: %d", texture_units)             # <<<<<<<<<<<<<<
 * 
 *         # Count the number of clip planes.
 */
  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__log); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __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__info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_to_py_GLint(__pyx_v_texture_units); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __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 = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_21));
  PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_21));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21));
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __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_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":432
 * 
 *         # Count the number of clip planes.
 *         cdef GLint clip_planes = 0             # <<<<<<<<<<<<<<
 * 
 *         glGetIntegerv(GL_MAX_CLIP_PLANES, &clip_planes)
 */
  __pyx_v_clip_planes = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":434
 *         cdef GLint clip_planes = 0
 * 
 *         glGetIntegerv(GL_MAX_CLIP_PLANES, &clip_planes)             # <<<<<<<<<<<<<<
 *         renpy.log.info("Number of clipping planes: %d", clip_planes)
 * 
 */
  glGetIntegerv(GL_MAX_CLIP_PLANES, (&__pyx_v_clip_planes));

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":435
 * 
 *         glGetIntegerv(GL_MAX_CLIP_PLANES, &clip_planes)
 *         renpy.log.info("Number of clipping planes: %d", clip_planes)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __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 = 435; __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_GLint(__pyx_v_clip_planes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_22));
  PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_22));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_22));
  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_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __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_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":441
 * 
 *         if use_subsystem(
 *             glenviron_shader,             # <<<<<<<<<<<<<<
 *             "RENPY_GL_ENVIRON",
 *             "shader",
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_shader); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __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__shader));
  PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_n_s__shader));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shader));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_23));
  PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_23));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_23));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_24));
  PyTuple_SET_ITEM(__pyx_t_7, 4, ((PyObject *)__pyx_n_s_24));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_24));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_v_use_subsystem, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_10) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":447
 *             "GL_ARB_fragment_shader"):
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 renpy.log.info("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 */
    {
      PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
      __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
      __Pyx_XGOTREF(__pyx_save_exc_type);
      __Pyx_XGOTREF(__pyx_save_exc_value);
      __Pyx_XGOTREF(__pyx_save_exc_tb);
      /*try:*/ {

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":448
 * 
 *             try:
 *                 renpy.log.info("Using shader environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 */
        __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L13_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__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
        PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_25));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
        __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":449
 *             try:
 *                 renpy.log.info("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "shader"
 *             except Exception, e:
 */
        __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_shader); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ShaderEnviron); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L13_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 = 449; __pyx_clineno = __LINE__; goto __pyx_L13_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_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
        __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
        ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ = __pyx_t_1;
        __pyx_t_1 = 0;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":450
 *                 renpy.log.info("Using shader environment.")
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"             # <<<<<<<<<<<<<<
 *             except Exception, e:
 *                 renpy.log.info("Initializing shader environment failed:")
 */
        if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__shader)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      }
      __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
      __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
      __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
      goto __pyx_L20_try_end;
      __pyx_L13_error:;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":451
 *                 self.environ = glenviron_shader.ShaderEnviron()
 *                 self.info["environ"] = "shader"
 *             except Exception, e:             # <<<<<<<<<<<<<<
 *                 renpy.log.info("Initializing shader environment failed:")
 *                 renpy.log.info(str(e))
 */
      __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
      if (__pyx_t_11) {
        __Pyx_AddTraceback("renpy.display.gldraw.init");
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_v_e);
        __pyx_v_e = __pyx_t_7;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":452
 *                 self.info["environ"] = "shader"
 *             except Exception, e:
 *                 renpy.log.info("Initializing shader environment failed:")             # <<<<<<<<<<<<<<
 *                 renpy.log.info(str(e))
 * 
 */
        __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __pyx_t_8 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__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 = 452; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(((PyObject *)__pyx_kp_s_26));
        PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_kp_s_26));
        __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_26));
        __pyx_t_12 = PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":453
 *             except Exception, e:
 *                 renpy.log.info("Initializing shader environment failed:")
 *                 renpy.log.info(str(e))             # <<<<<<<<<<<<<<
 * 
 *         if self.environ is None:
 */
        __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __pyx_t_8 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__log); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__info); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__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 = 453; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_INCREF(__pyx_v_e);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_e);
        __Pyx_GIVEREF(__pyx_v_e);
        __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyString_Type)), __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__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 = 453; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        __pyx_t_5 = 0;
        __pyx_t_5 = PyObject_Call(__pyx_t_12, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__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;
        goto __pyx_L14_exception_handled;
      }
      __pyx_L15_except_error:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      goto __pyx_L1_error;
      __pyx_L14_exception_handled:;
      __Pyx_XGIVEREF(__pyx_save_exc_type);
      __Pyx_XGIVEREF(__pyx_save_exc_value);
      __Pyx_XGIVEREF(__pyx_save_exc_tb);
      __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
      __pyx_L20_try_end:;
    }
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":455
 *                 renpy.log.info(str(e))
 * 
 *         if self.environ is None:             # <<<<<<<<<<<<<<
 * 
 *             if use_subsystem(
 */
  __pyx_t_10 = (((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ == Py_None);
  if (__pyx_t_10) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":458
 * 
 *             if use_subsystem(
 *                 glenviron_fixed,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "fixed",
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __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_27));
    PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_27));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_27));
    __Pyx_INCREF(((PyObject *)__pyx_n_s_28));
    PyTuple_SET_ITEM(__pyx_t_7, 4, ((PyObject *)__pyx_n_s_28));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_28));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_v_use_subsystem, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_10) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":464
 *                 "GL_ARB_texture_env_combine"):
 * 
 *                 renpy.log.info("Using fixed-function environment (clause 1).")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __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__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_29));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
      __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __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_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":465
 * 
 *                 renpy.log.info("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["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 = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_30); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __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 = 465; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
      __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
      ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":466
 *                 renpy.log.info("Using fixed-function environment (clause 1).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 * 
 *             elif use_subsystem(
 */
      if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__fixed)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L24;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":469
 * 
 *             elif 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 = 469; __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 = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__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_31));
    PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_31));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_31));
    __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_Call(__pyx_v_use_subsystem, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_10) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":474
 *                 "GL_NV_texture_env_combine4"):
 * 
 *                 renpy.log.info("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 = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __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__info); 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(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_32));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_32));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_32));
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 474; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__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;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":475
 * 
 *                 renpy.log.info("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "fixed"
 * 
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_fixed); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s_30); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __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_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_GIVEREF(__pyx_t_2);
      __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
      __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
      ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":476
 *                 renpy.log.info("Using fixed-function environment (clause 2).")
 *                 self.environ = glenviron_fixed.FixedFunctionEnviron()
 *                 self.info["environ"] = "fixed"             # <<<<<<<<<<<<<<
 * 
 *             elif use_subsystem(
 */
      if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__fixed)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L24;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":479
 * 
 *             elif use_subsystem(
 *                 glenviron_limited,             # <<<<<<<<<<<<<<
 *                 "RENPY_GL_ENVIRON",
 *                 "limited",
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_limited); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __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__limited));
    PyTuple_SET_ITEM(__pyx_t_7, 2, ((PyObject *)__pyx_n_s__limited));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s__limited));
    __Pyx_INCREF(((PyObject *)__pyx_n_s_33));
    PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_33));
    __Pyx_GIVEREF(((PyObject *)__pyx_n_s_33));
    __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_v_use_subsystem, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_10) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":484
 *                 "RENPY_bogus_extension"):
 * 
 *                 renpy.log.info("Using limited environment.")             # <<<<<<<<<<<<<<
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"
 */
      __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __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__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_34));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_34));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_34));
      __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __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_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":485
 * 
 *                 renpy.log.info("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()             # <<<<<<<<<<<<<<
 *                 self.info["environ"] = "limited"
 * 
 */
      __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__glenviron_limited); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__LimitedEnviron); 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(__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 = 485; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
      __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ);
      ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":486
 *                 renpy.log.info("Using limited environment.")
 *                 self.environ = glenviron_limited.LimitedEnviron()
 *                 self.info["environ"] = "limited"             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__environ), ((PyObject *)__pyx_n_s__limited)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L24;
    }
    /*else*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":489
 * 
 *             else:
 *                 renpy.log.info("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 = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __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__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(((PyObject *)__pyx_kp_s_35));
      PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_35));
      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_35));
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__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;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":490
 *             else:
 *                 renpy.log.info("Can't find a workable environment.")
 *                 return False             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __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_L24:;
    goto __pyx_L23;
  }
  __pyx_L23:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":494
 * 
 *         if use_subsystem(
 *             glrtt_fbo,             # <<<<<<<<<<<<<<
 *             "RENPY_GL_RTT",
 *             "fbo",
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__glrtt_fbo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __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_36));
  PyTuple_SET_ITEM(__pyx_t_7, 3, ((PyObject *)__pyx_n_s_36));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_36));
  __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_v_use_subsystem, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_10) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":499
 *             "GL_OES_framebuffer_object"):
 * 
 *             renpy.log.info("Using FBO RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __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__info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_37));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_37));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_37));
    __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __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_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":500
 * 
 *             renpy.log.info("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()             # <<<<<<<<<<<<<<
 *             self.info["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 = 500; __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 = 500; __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 = 500; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":501
 *             renpy.log.info("Using FBO RTT.")
 *             self.rtt = glrtt_fbo.FboRtt()
 *             self.info["rtt"] = "fbo"             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__rtt), ((PyObject *)__pyx_n_s__fbo)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L25;
  }
  /*else*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":505
 *         else:
 *             # Pick a Render-to-texture subsystem.
 *             renpy.log.info("Using copy RTT.")             # <<<<<<<<<<<<<<
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__log); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __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__info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_38));
    PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_38));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_38));
    __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __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_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":506
 *             # Pick a Render-to-texture subsystem.
 *             renpy.log.info("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()             # <<<<<<<<<<<<<<
 *             self.info["rtt"] = "copy"
 * 
 */
    __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__glrtt_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__CopyRtt); 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_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_GIVEREF(__pyx_t_2);
    __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":507
 *             renpy.log.info("Using copy RTT.")
 *             self.rtt = glrtt_copy.CopyRtt()
 *             self.info["rtt"] = "copy"             # <<<<<<<<<<<<<<
 * 
 *         # Do additional setup needed.
 */
    if (PyDict_SetItem(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info), ((PyObject *)__pyx_n_s__rtt), ((PyObject *)__pyx_n_s__copy)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L25:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":510
 * 
 *         # Do additional setup needed.
 *         renpy.display.pgrender.set_rgba_masks()             # <<<<<<<<<<<<<<
 * 
 *         return True
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __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__pgrender); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__set_rgba_masks); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __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_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":512
 *         renpy.display.pgrender.set_rgba_masks()
 * 
 *         return True             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __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_12);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.init");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_err);
  __Pyx_DECREF(__pyx_v_renderer);
  __Pyx_DECREF(__pyx_v_version);
  __Pyx_DECREF(__pyx_v_r);
  __Pyx_DECREF(__pyx_v_v);
  __Pyx_DECREF(__pyx_v_extensions_string);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_extensions);
  __Pyx_DECREF(__pyx_v_i);
  __Pyx_DECREF(__pyx_v_use_subsystem);
  __Pyx_DECREF(__pyx_v_e);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":515
 * 
 * 
 *     def should_redraw(self, needs_redraw, first_pass):             # <<<<<<<<<<<<<<
 *         """
 *         Redraw whenever the screen needs it, but at least once every
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_should_redraw(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_should_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_7display_6gldraw_6GLDraw_should_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;
  PyObject *__pyx_v_my;
  PyObject *__pyx_v_tex;
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  double __pyx_t_8;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__needs_redraw,&__pyx_n_s__first_pass,0};
  __Pyx_RefNannySetupContext("should_redraw");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    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 = 515; __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 = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_needs_redraw = values[0];
    __pyx_v_first_pass = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_needs_redraw = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_first_pass = PyTuple_GET_ITEM(__pyx_args, 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 = 515; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.should_redraw");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_mx = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_my = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tex = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":522
 *         """
 * 
 *         rv = False             # <<<<<<<<<<<<<<
 * 
 *         if needs_redraw:
 */
  __pyx_v_rv = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":524
 *         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 = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":525
 * 
 *         if needs_redraw:
 *             rv = True             # <<<<<<<<<<<<<<
 *         elif first_pass:
 *             rv = True
 */
    __pyx_v_rv = 1;
    goto __pyx_L6;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":526
 *         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 = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":527
 *             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;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":528
 *         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 = 528; __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 = 528; __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 = 528; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->last_redraw_time + ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->redraw_period)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __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 = 528; __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 = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_1) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":529
 *             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*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":532
 *         else:
 *             # Redraw if the mouse moves.
 *             mx, my, tex = self.mouse_info             # <<<<<<<<<<<<<<
 *             if tex and (mx, my) != pygame.mouse.get_pos():
 *                 rv = True
 */
    if (PyTuple_CheckExact(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info) && likely(PyTuple_GET_SIZE(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info) == 3)) {
      PyObject* tuple = ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_mx);
      __pyx_v_mx = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_my);
      __pyx_v_my = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_tex);
      __pyx_v_tex = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __pyx_t_5 = PyObject_GetIter(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_5, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_5, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_5, 2); 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);
      if (__Pyx_EndUnpack(__pyx_t_5, 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_mx);
      __pyx_v_mx = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_my);
      __pyx_v_my = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_tex);
      __pyx_v_tex = __pyx_t_2;
      __pyx_t_2 = 0;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":533
 *             # 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 = 533; __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 = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__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 = 533; __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 = 533; __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 = 533; __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 = 533; __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(__pyx_t_2, __pyx_t_4, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_7 = __pyx_t_6;
    } else {
      __pyx_t_7 = __pyx_t_1;
    }
    if (__pyx_t_7) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":534
 *             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_L7;
    }
    __pyx_L7:;
  }
  __pyx_L6:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":537
 * 
 *         # Store the redraw time.
 *         if rv:             # <<<<<<<<<<<<<<
 *             self.last_redraw_time = time.time()
 *             return True
 */
  if (__pyx_v_rv) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":538
 *         # 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 = 538; __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 = 538; __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 = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->last_redraw_time = __pyx_t_8;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":539
 *         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 = 539; __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_L8;
  }
  /*else*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":541
 *             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 = 541; __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_L8:;

  __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.display.gldraw.GLDraw.should_redraw");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_mx);
  __Pyx_DECREF(__pyx_v_my);
  __Pyx_DECREF(__pyx_v_tex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":543
 *             return False
 * 
 *     def mutated_surface(self, surf):             # <<<<<<<<<<<<<<
 *         if surf in self.texture_cache:
 *             del self.texture_cache[surf]
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_mutated_surface(PyObject *__pyx_v_self, PyObject *__pyx_v_surf) {
  PyObject *__pyx_r = NULL;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("mutated_surface");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":544
 * 
 *     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_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_v_surf))); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":545
 *     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_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_v_surf) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __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.display.gldraw.GLDraw.mutated_surface");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":547
 *             del self.texture_cache[surf]
 * 
 *     def load_texture(self, surf, transient=False):             # <<<<<<<<<<<<<<
 *         # Turn a surface into a texture grid.
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_load_texture(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_load_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;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surf,&__pyx_n_s__transient,0};
  __Pyx_RefNannySetupContext("load_texture");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k_39;
    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;
    }
    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 = 547; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_surf = values[0];
    __pyx_v_transient = values[1];
  } else {
    __pyx_v_transient = __pyx_k_39;
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  2: __pyx_v_transient = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: __pyx_v_surf = PyTuple_GET_ITEM(__pyx_args, 0);
      break;
      default: goto __pyx_L5_argtuple_error;
    }
  }
  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 = 547; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.load_texture");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_rv = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":550
 *         # 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_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __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 = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_surf);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_surf);
  __Pyx_GIVEREF(__pyx_v_surf);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_rv);
  __pyx_v_rv = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":552
 *         rv = self.texture_cache.get(surf, None)
 * 
 *         if rv is None:             # <<<<<<<<<<<<<<
 *             rv = gltexture.texture_grid_from_surface(surf)
 *             self.texture_cache[surf] = rv
 */
  __pyx_t_4 = (__pyx_v_rv == Py_None);
  if (__pyx_t_4) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":553
 * 
 *         if rv is None:
 *             rv = gltexture.texture_grid_from_surface(surf)             # <<<<<<<<<<<<<<
 *             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 = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s_40); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_surf);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_surf);
    __Pyx_GIVEREF(__pyx_v_surf);
    __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __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_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_rv);
    __pyx_v_rv = __pyx_t_1;
    __pyx_t_1 = 0;

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":556
 *             self.texture_cache[surf] = rv
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     # private
 */
  __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.display.gldraw.GLDraw.load_texture");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":560
 *     # private
 * 
 *     def clip_mode_screen(self):             # <<<<<<<<<<<<<<
 *         """
 *         This does two things. First, it shuts down clipping, and clears
 */

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":568
 *         """
 * 
 *         self.clip_cache = None             # <<<<<<<<<<<<<<
 *         self.clip_rtt_box = None
 *         glDisable(GL_SCISSOR_TEST)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_cache);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_cache));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_cache = ((PyObject *)Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":569
 * 
 *         self.clip_cache = None
 *         self.clip_rtt_box = None             # <<<<<<<<<<<<<<
 *         glDisable(GL_SCISSOR_TEST)
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box = ((PyObject *)Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":570
 *         self.clip_cache = None
 *         self.clip_rtt_box = None
 *         glDisable(GL_SCISSOR_TEST)             # <<<<<<<<<<<<<<
 * 
 *     def clip_mode_rtt(self, x, y, w, h):
 */
  glDisable(GL_SCISSOR_TEST);

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":572
 *         glDisable(GL_SCISSOR_TEST)
 * 
 *     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_7display_6gldraw_6GLDraw_clip_mode_rtt(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_clip_mode_rtt[] = "\n        The same thing, except the screen is projected in RTT mode.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_clip_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;
  PyObject *__pyx_t_1 = NULL;
  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");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    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;
    }
    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 = 572; __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 = 572; __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 = 572; __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 = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_y = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_w = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_h = PyTuple_GET_ITEM(__pyx_args, 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 = 572; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.clip_mode_rtt");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":577
 *         """
 * 
 *         self.clip_cache = None             # <<<<<<<<<<<<<<
 *         self.clip_rtt_box = (x, y, w, h)
 *         glDisable(GL_SCISSOR_TEST)
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_cache);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_cache));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_cache = ((PyObject *)Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":578
 * 
 *         self.clip_cache = None
 *         self.clip_rtt_box = (x, y, w, h)             # <<<<<<<<<<<<<<
 *         glDisable(GL_SCISSOR_TEST)
 * 
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->clip_rtt_box = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":579
 *         self.clip_cache = None
 *         self.clip_rtt_box = (x, y, w, h)
 *         glDisable(GL_SCISSOR_TEST)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  glDisable(GL_SCISSOR_TEST);

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":583
 * 
 *     # private
 *     cpdef set_clip(GLDraw self, tuple clip):             # <<<<<<<<<<<<<<
 * 
 *         cdef double minx, miny, maxx, maxy
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static  PyObject *__pyx_f_5renpy_7display_6gldraw_6GLDraw_set_clip(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *__pyx_v_self, PyObject *__pyx_v_clip, int __pyx_skip_dispatch) {
  double __pyx_v_minx;
  double __pyx_v_miny;
  double __pyx_v_maxx;
  double __pyx_v_maxy;
  double __pyx_v_vwidth;
  double __pyx_v_vheight;
  double __pyx_v_px;
  double __pyx_v_py;
  double __pyx_v_pw;
  double __pyx_v_ph;
  int __pyx_v_cx;
  int __pyx_v_cy;
  int __pyx_v_cw;
  int __pyx_v_ch;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  double __pyx_t_6;
  double __pyx_t_7;
  double __pyx_t_8;
  double __pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  __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 = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_7display_6gldraw_6GLDraw_set_clip)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(((PyObject *)__pyx_v_clip));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_clip));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_clip));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__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;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":590
 *         cdef int cx, cy, cw, ch
 * 
 *         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 = 590; __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 = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":591
 * 
 *         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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":593
 *             return
 * 
 *         self.clip_cache = clip             # <<<<<<<<<<<<<<
 * 
 *         minx, miny, maxx, maxy = clip
 */
  __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":595
 *         self.clip_cache = clip
 * 
 *         minx, miny, maxx, maxy = clip             # <<<<<<<<<<<<<<
 * 
 *         if self.use_clipping_planes:
 */
  if (likely(((PyObject *)__pyx_v_clip) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_clip)) == 4)) {
    PyObject* tuple = ((PyObject *)__pyx_v_clip);
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__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 = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_5);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_v_minx = __pyx_t_6;
    __pyx_v_miny = __pyx_t_7;
    __pyx_v_maxx = __pyx_t_8;
    __pyx_v_maxy = __pyx_t_9;
  } else {
    __Pyx_UnpackTupleError(((PyObject *)__pyx_v_clip), 4);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":597
 *         minx, miny, maxx, maxy = clip
 * 
 *         if self.use_clipping_planes:             # <<<<<<<<<<<<<<
 * 
 *             gl_clip(GL_CLIP_PLANE0, 1.0, 0.0, 0.0, -minx)
 */
  if (__pyx_v_self->use_clipping_planes) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":599
 *         if self.use_clipping_planes:
 * 
 *             gl_clip(GL_CLIP_PLANE0, 1.0, 0.0, 0.0, -minx)             # <<<<<<<<<<<<<<
 *             gl_clip(GL_CLIP_PLANE1, 0.0, 1.0, 0.0, -miny)
 *             gl_clip(GL_CLIP_PLANE2, -1.0, 0.0, 0.0, maxx)
 */
    __pyx_f_5renpy_7display_6gldraw_gl_clip(GL_CLIP_PLANE0, 1.0, 0.0, 0.0, (-__pyx_v_minx));

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":600
 * 
 *             gl_clip(GL_CLIP_PLANE0, 1.0, 0.0, 0.0, -minx)
 *             gl_clip(GL_CLIP_PLANE1, 0.0, 1.0, 0.0, -miny)             # <<<<<<<<<<<<<<
 *             gl_clip(GL_CLIP_PLANE2, -1.0, 0.0, 0.0, maxx)
 *             gl_clip(GL_CLIP_PLANE3, 0.0, -1.0, 0.0, maxy)
 */
    __pyx_f_5renpy_7display_6gldraw_gl_clip(GL_CLIP_PLANE1, 0.0, 1.0, 0.0, (-__pyx_v_miny));

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":601
 *             gl_clip(GL_CLIP_PLANE0, 1.0, 0.0, 0.0, -minx)
 *             gl_clip(GL_CLIP_PLANE1, 0.0, 1.0, 0.0, -miny)
 *             gl_clip(GL_CLIP_PLANE2, -1.0, 0.0, 0.0, maxx)             # <<<<<<<<<<<<<<
 *             gl_clip(GL_CLIP_PLANE3, 0.0, -1.0, 0.0, maxy)
 * 
 */
    __pyx_f_5renpy_7display_6gldraw_gl_clip(GL_CLIP_PLANE2, (-1.0), 0.0, 0.0, __pyx_v_maxx);

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":602
 *             gl_clip(GL_CLIP_PLANE1, 0.0, 1.0, 0.0, -miny)
 *             gl_clip(GL_CLIP_PLANE2, -1.0, 0.0, 0.0, maxx)
 *             gl_clip(GL_CLIP_PLANE3, 0.0, -1.0, 0.0, maxy)             # <<<<<<<<<<<<<<
 * 
 *         else:
 */
    __pyx_f_5renpy_7display_6gldraw_gl_clip(GL_CLIP_PLANE3, 0.0, (-1.0), 0.0, __pyx_v_maxy);
    goto __pyx_L4;
  }
  /*else*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":606
 *         else:
 * 
 *             if self.clip_rtt_box is None:             # <<<<<<<<<<<<<<
 * 
 *                 vwidth, vheight = self.virtual_size
 */
    __pyx_t_4 = (__pyx_v_self->clip_rtt_box == ((PyObject *)Py_None));
    if (__pyx_t_4) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":608
 *             if self.clip_rtt_box is None:
 * 
 *                 vwidth, vheight = self.virtual_size             # <<<<<<<<<<<<<<
 *                 px, py, pw, ph = self.physical_box
 * 
 */
      if (likely(((PyObject *)__pyx_v_self->virtual_size) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_self->virtual_size)) == 2)) {
        PyObject* tuple = ((PyObject *)__pyx_v_self->virtual_size);
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__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 = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_vwidth = __pyx_t_9;
        __pyx_v_vheight = __pyx_t_8;
      } else {
        __Pyx_UnpackTupleError(((PyObject *)__pyx_v_self->virtual_size), 2);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":609
 * 
 *                 vwidth, vheight = self.virtual_size
 *                 px, py, pw, ph = self.physical_box             # <<<<<<<<<<<<<<
 * 
 *                 minx = px + (minx / vwidth) * pw
 */
      if (likely(((PyObject *)__pyx_v_self->physical_box) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_self->physical_box)) == 4)) {
        PyObject* tuple = ((PyObject *)__pyx_v_self->physical_box);
        __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__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 = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_3 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_3);
        __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_1 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_1);
        __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_v_px = __pyx_t_8;
        __pyx_v_py = __pyx_t_9;
        __pyx_v_pw = __pyx_t_7;
        __pyx_v_ph = __pyx_t_6;
      } else {
        __Pyx_UnpackTupleError(((PyObject *)__pyx_v_self->physical_box), 4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":611
 *                 px, py, pw, ph = self.physical_box
 * 
 *                 minx = px + (minx / vwidth) * pw             # <<<<<<<<<<<<<<
 *                 maxx = px + (maxx / vwidth) * pw
 * 
 */
      if (unlikely(__pyx_v_vwidth == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_minx = (__pyx_v_px + ((__pyx_v_minx / __pyx_v_vwidth) * __pyx_v_pw));

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":612
 * 
 *                 minx = px + (minx / vwidth) * pw
 *                 maxx = px + (maxx / vwidth) * pw             # <<<<<<<<<<<<<<
 * 
 *                 miny = py + (miny / vheight) * ph
 */
      if (unlikely(__pyx_v_vwidth == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_maxx = (__pyx_v_px + ((__pyx_v_maxx / __pyx_v_vwidth) * __pyx_v_pw));

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":614
 *                 maxx = px + (maxx / vwidth) * pw
 * 
 *                 miny = py + (miny / vheight) * ph             # <<<<<<<<<<<<<<
 *                 maxy = py + (maxy / vheight) * ph
 * 
 */
      if (unlikely(__pyx_v_vheight == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_miny = (__pyx_v_py + ((__pyx_v_miny / __pyx_v_vheight) * __pyx_v_ph));

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":615
 * 
 *                 miny = py + (miny / vheight) * ph
 *                 maxy = py + (maxy / vheight) * ph             # <<<<<<<<<<<<<<
 * 
 *                 miny = ph - miny
 */
      if (unlikely(__pyx_v_vheight == 0)) {
        PyErr_Format(PyExc_ZeroDivisionError, "float division");
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __pyx_v_maxy = (__pyx_v_py + ((__pyx_v_maxy / __pyx_v_vheight) * __pyx_v_ph));

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":617
 *                 maxy = py + (maxy / vheight) * ph
 * 
 *                 miny = ph - miny             # <<<<<<<<<<<<<<
 *                 maxy = ph - maxy
 * 
 */
      __pyx_v_miny = (__pyx_v_ph - __pyx_v_miny);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":618
 * 
 *                 miny = ph - miny
 *                 maxy = ph - maxy             # <<<<<<<<<<<<<<
 * 
 *                 glEnable(GL_SCISSOR_TEST)
 */
      __pyx_v_maxy = (__pyx_v_ph - __pyx_v_maxy);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":620
 *                 maxy = ph - maxy
 * 
 *                 glEnable(GL_SCISSOR_TEST)             # <<<<<<<<<<<<<<
 *                 glScissor(<GLint> round(minx), <GLint> round(maxy), <GLint> round(maxx - minx), <GLsizei> round(miny - maxy))
 * 
 */
      glEnable(GL_SCISSOR_TEST);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":621
 * 
 *                 glEnable(GL_SCISSOR_TEST)
 *                 glScissor(<GLint> round(minx), <GLint> round(maxy), <GLint> round(maxx - minx), <GLsizei> round(miny - maxy))             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      glScissor(((GLint)__pyx_f_5renpy_7display_6gldraw_round(__pyx_v_minx)), ((GLint)__pyx_f_5renpy_7display_6gldraw_round(__pyx_v_maxy)), ((GLint)__pyx_f_5renpy_7display_6gldraw_round((__pyx_v_maxx - __pyx_v_minx))), ((GLsizei)__pyx_f_5renpy_7display_6gldraw_round((__pyx_v_miny - __pyx_v_maxy))));
      goto __pyx_L5;
    }
    /*else*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":625
 *             else:
 * 
 *                 cx, cy, cw, ch = self.clip_rtt_box             # <<<<<<<<<<<<<<
 * 
 *                 glEnable(GL_SCISSOR_TEST)
 */
      if (likely(((PyObject *)__pyx_v_self->clip_rtt_box) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_self->clip_rtt_box)) == 4)) {
        PyObject* tuple = ((PyObject *)__pyx_v_self->clip_rtt_box);
        __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
        __pyx_t_10 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
        __pyx_t_11 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_5 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_5);
        __pyx_t_12 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_2 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_2);
        __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_v_cx = __pyx_t_10;
        __pyx_v_cy = __pyx_t_11;
        __pyx_v_cw = __pyx_t_12;
        __pyx_v_ch = __pyx_t_13;
      } else {
        __Pyx_UnpackTupleError(((PyObject *)__pyx_v_self->clip_rtt_box), 4);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":627
 *                 cx, cy, cw, ch = self.clip_rtt_box
 * 
 *                 glEnable(GL_SCISSOR_TEST)             # <<<<<<<<<<<<<<
 *                 glScissor(<GLint> round(minx - cx), <GLint> round(miny - cy), <GLint> round(maxx - minx), <GLint> round(maxy - miny))
 * 
 */
      glEnable(GL_SCISSOR_TEST);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":628
 * 
 *                 glEnable(GL_SCISSOR_TEST)
 *                 glScissor(<GLint> round(minx - cx), <GLint> round(miny - cy), <GLint> round(maxx - minx), <GLint> round(maxy - miny))             # <<<<<<<<<<<<<<
 * 
 * 
 */
      glScissor(((GLint)__pyx_f_5renpy_7display_6gldraw_round((__pyx_v_minx - __pyx_v_cx))), ((GLint)__pyx_f_5renpy_7display_6gldraw_round((__pyx_v_miny - __pyx_v_cy))), ((GLint)__pyx_f_5renpy_7display_6gldraw_round((__pyx_v_maxx - __pyx_v_minx))), ((GLint)__pyx_f_5renpy_7display_6gldraw_round((__pyx_v_maxy - __pyx_v_miny))));
    }
    __pyx_L5:;
  }
  __pyx_L4:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.set_clip");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":583
 * 
 *     # private
 *     cpdef set_clip(GLDraw self, tuple clip):             # <<<<<<<<<<<<<<
 * 
 *         cdef double minx, miny, maxx, maxy
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_set_clip(PyObject *__pyx_v_self, PyObject *__pyx_v_clip) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("set_clip");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_clip), &PyTuple_Type, 1, "clip", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->set_clip(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_clip, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.set_clip");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":631
 * 
 * 
 *     def draw_screen(self, surftree, fullscreen_video):             # <<<<<<<<<<<<<<
 *         """
 *         Draws the screen.
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_screen(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_draw_screen[] = "\n        Draws the screen.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_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_forward;
  PyObject *__pyx_v_reverse;
  PyObject *__pyx_v_clip;
  PyObject *__pyx_v_tex;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  GLint __pyx_t_3;
  GLint __pyx_t_4;
  GLsizei __pyx_t_5;
  GLsizei __pyx_t_6;
  GLdouble __pyx_t_7;
  GLdouble __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  double __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__surftree,&__pyx_n_s__fullscreen_video,0};
  __Pyx_RefNannySetupContext("draw_screen");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    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", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __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_screen") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_surftree = values[0];
    __pyx_v_fullscreen_video = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_surftree = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_fullscreen_video = PyTuple_GET_ITEM(__pyx_args, 1);
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_screen", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.draw_screen");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_forward = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_reverse = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_clip = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tex = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":636
 *         """
 * 
 *         forward = reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         surftree.is_opaque()
 */
  __Pyx_INCREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_v_forward);
  __pyx_v_forward = __pyx_v_5renpy_7display_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_v_reverse);
  __pyx_v_reverse = __pyx_v_5renpy_7display_6gldraw_IDENTITY;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":638
 *         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 = 638; __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 = 638; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":640
 *         surftree.is_opaque()
 * 
 *         self.draw_render_textures(surftree, 0)             # <<<<<<<<<<<<<<
 * 
 *         glViewport(self.physical_box[0], self.physical_box[1], self.physical_box[2], self.physical_box[3])
 */
  ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_render_textures(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surftree, 0, 0);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":642
 *         self.draw_render_textures(surftree, 0)
 * 
 *         glViewport(self.physical_box[0], self.physical_box[1], self.physical_box[2], self.physical_box[3])             # <<<<<<<<<<<<<<
 * 
 *         glMatrixMode(GL_PROJECTION)
 */
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_from_py_GLint(__pyx_t_2); if (unlikely((__pyx_t_3 == (GLint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_from_py_GLint(__pyx_t_2); if (unlikely((__pyx_t_4 == (GLint)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyInt_from_py_GLsizei(__pyx_t_2); if (unlikely((__pyx_t_5 == (GLsizei)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box), 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_6 = __Pyx_PyInt_from_py_GLsizei(__pyx_t_2); if (unlikely((__pyx_t_6 == (GLsizei)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  glViewport(__pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":644
 *         glViewport(self.physical_box[0], self.physical_box[1], self.physical_box[2], self.physical_box[3])
 * 
 *         glMatrixMode(GL_PROJECTION)             # <<<<<<<<<<<<<<
 *         glLoadIdentity()
 *         glOrtho(0, self.virtual_size[0], self.virtual_size[1], 0, -1.0, 1.0)
 */
  glMatrixMode(GL_PROJECTION);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":645
 * 
 *         glMatrixMode(GL_PROJECTION)
 *         glLoadIdentity()             # <<<<<<<<<<<<<<
 *         glOrtho(0, self.virtual_size[0], self.virtual_size[1], 0, -1.0, 1.0)
 * 
 */
  glLoadIdentity();

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":646
 *         glMatrixMode(GL_PROJECTION)
 *         glLoadIdentity()
 *         glOrtho(0, self.virtual_size[0], self.virtual_size[1], 0, -1.0, 1.0)             # <<<<<<<<<<<<<<
 * 
 *         glMatrixMode(GL_MODELVIEW)
 */
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (GLdouble)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (GLdouble)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  glOrtho(0.0, __pyx_t_7, __pyx_t_8, 0.0, (-1.0), 1.0);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":648
 *         glOrtho(0, self.virtual_size[0], self.virtual_size[1], 0, -1.0, 1.0)
 * 
 *         glMatrixMode(GL_MODELVIEW)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_screen()
 */
  glMatrixMode(GL_MODELVIEW);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":650
 *         glMatrixMode(GL_MODELVIEW)
 * 
 *         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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/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);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":653
 * 
 *         glClearColor(0.0, 0.0, 0.0, 1.0)
 *         glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *         clip = (0, 0, self.virtual_size[0], self.virtual_size[1])
 */
  glClear(GL_COLOR_BUFFER_BIT);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":655
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 *         clip = (0, 0, self.virtual_size[0], self.virtual_size[1])             # <<<<<<<<<<<<<<
 * 
 *         self.upscale_factor = 1.0 * self.physical_size[0] / self.virtual_size[0]
 */
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_7display_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_7display_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(__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;
  if (!(likely(PyTuple_CheckExact(__pyx_t_9))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_9)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_clip));
  __pyx_v_clip = ((PyObject *)__pyx_t_9);
  __pyx_t_9 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":657
 *         clip = (0, 0, self.virtual_size[0], self.virtual_size[1])
 * 
 *         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 = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_2 = __Pyx_GetItemInt_Tuple(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __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 = 657; __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_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __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 = 657; __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_10 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->upscale_factor = __pyx_t_10;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":659
 *         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:             # <<<<<<<<<<<<<<
 *             tex = renpy.display.video.get_movie_texture(self.virtual_size)
 * 
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __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 = 659; __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 = 659; __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 = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__movie));
  PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_n_s__movie));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__movie));
  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __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_9); __pyx_t_9 = 0;
  __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_11) {
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__video); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__fullscreen); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_13 = __pyx_t_12;
  } else {
    __pyx_t_13 = __pyx_t_11;
  }
  if (__pyx_t_13) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":660
 * 
 *         if renpy.audio.music.get_playing("movie") and renpy.display.video.fullscreen:
 *             tex = renpy.display.video.get_movie_texture(self.virtual_size)             # <<<<<<<<<<<<<<
 * 
 *             # self.load_texture(self.fullscreen_surface, transient=True)
 */
    __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_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__display); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __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_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__get_movie_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
    PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
    __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size));
    __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); 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_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_v_tex);
    __pyx_v_tex = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":663
 * 
 *             # self.load_texture(self.fullscreen_surface, transient=True)
 *             self.draw_transformed(tex, clip, 0, 0, 1.0, reverse)             # <<<<<<<<<<<<<<
 *         else:
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, reverse)
 */
    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;}
    ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_tex, __pyx_v_clip, 0.0, 0.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse), 0);
    goto __pyx_L6;
  }
  /*else*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":665
 *             self.draw_transformed(tex, clip, 0, 0, 1.0, reverse)
 *         else:
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         self.draw_mouse()
 */
    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 = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_surftree, __pyx_v_clip, 0.0, 0.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse), 0);
  }
  __pyx_L6:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":667
 *             self.draw_transformed(surftree, clip, 0, 0, 1.0, reverse)
 * 
 *         self.draw_mouse()             # <<<<<<<<<<<<<<
 * 
 *         # Release the CPU while we're waiting for things to actually
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__draw_mouse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":671
 *         # Release the CPU while we're waiting for things to actually
 *         # draw to the screen.
 *         renpy.display.core.cpu_idle.set()             # <<<<<<<<<<<<<<
 *         pygame.display.flip()
 *         renpy.display.core.cpu_idle.clear()
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __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 = 671; __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__core); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __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__cpu_idle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __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__set); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __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_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":672
 *         # draw to the screen.
 *         renpy.display.core.cpu_idle.set()
 *         pygame.display.flip()             # <<<<<<<<<<<<<<
 *         renpy.display.core.cpu_idle.clear()
 * 
 */
  __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__pygame); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_9 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __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__flip); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":673
 *         renpy.display.core.cpu_idle.set()
 *         pygame.display.flip()
 *         renpy.display.core.cpu_idle.clear()             # <<<<<<<<<<<<<<
 * 
 *         gl_check("draw_screen")
 */
  __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __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 = 673; __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__core); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __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__cpu_idle); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __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__clear); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __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_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":675
 *         renpy.display.core.cpu_idle.clear()
 * 
 *         gl_check("draw_screen")             # <<<<<<<<<<<<<<
 * 
 *     cpdef int draw_render_textures(GLDraw self, what, bint non_aligned):
 */
  __pyx_t_2 = __pyx_f_5renpy_7display_2gl_gl_check(((PyObject *)__pyx_n_s__draw_screen)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __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_9);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.draw_screen");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_forward);
  __Pyx_DECREF(__pyx_v_reverse);
  __Pyx_DECREF(__pyx_v_clip);
  __Pyx_DECREF(__pyx_v_tex);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":677
 *         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_7display_6gldraw_6GLDraw_draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  int __pyx_f_5renpy_7display_6gldraw_6GLDraw_draw_render_textures(struct __pyx_obj_5renpy_7display_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;
  int __pyx_v_render_what;
  int __pyx_v_first;
  PyObject *__pyx_v_child;
  PyObject *__pyx_v_cxo;
  PyObject *__pyx_v_cyo;
  PyObject *__pyx_v_focus;
  PyObject *__pyx_v_main;
  PyObject *__pyx_v_p;
  PyObject *__pyx_v_pc;
  int __pyx_r;
  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;
  __Pyx_RefNannySetupContext("draw_render_textures");
  __pyx_v_rend = ((struct __pyx_obj_5renpy_7display_6render_Render *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_child = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_cxo = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_cyo = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_focus = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_main = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_p = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_pc = Py_None; __Pyx_INCREF(Py_None);
  /* 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_41); 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);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_render_textures)) {
      __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_non_aligned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __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 = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_what);
      __Pyx_GIVEREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__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 = 677; __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;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":686
 *         cdef bint render_what
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_5 = PyObject_TypeCheck(__pyx_v_what, ((PyTypeObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render))); 
  __pyx_t_6 = (!__pyx_t_5);
  if (__pyx_t_6) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":687
 * 
 *         if not isinstance(what, render.Render):
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         rend = <render.Render> what
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":689
 *             return 0
 * 
 *         rend = <render.Render> what             # <<<<<<<<<<<<<<
 * 
 *         render_what = False
 */
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_what)));
  __Pyx_DECREF(((PyObject *)__pyx_v_rend));
  __pyx_v_rend = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_what);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":691
 *         rend = <render.Render> what
 * 
 *         render_what = False             # <<<<<<<<<<<<<<
 * 
 *         if rend.clipping and non_aligned:
 */
  __pyx_v_render_what = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":693
 *         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) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":694
 * 
 *         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) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":695
 *         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;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":696
 *             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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":698
 *                 non_aligned = False
 * 
 *         first = True             # <<<<<<<<<<<<<<
 * 
 *         if rend.forward:
 */
  __pyx_v_first = 1;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":700
 *         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 = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":701
 * 
 *         if rend.forward:
 *             non_aligned |= (rend.forward.xdy != 0)             # <<<<<<<<<<<<<<
 *             non_aligned |= (rend.forward.ydy != 0)
 * 
 */
    __pyx_v_non_aligned |= (__pyx_v_rend->forward->xdy != 0.0);

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":702
 *         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_rend->forward->ydy != 0.0);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":704
 *             non_aligned |= (rend.forward.ydy != 0)
 * 
 *         for child, cxo, cyo, focus, main in rend.visible_children:             # <<<<<<<<<<<<<<
 * 
 *             self.draw_render_textures(child, non_aligned)
 */
  if (likely(((PyObject *)__pyx_v_rend->visible_children) != Py_None)) {
    __pyx_t_8 = 0; __pyx_t_1 = ((PyObject *)__pyx_v_rend->visible_children); __Pyx_INCREF(__pyx_t_1);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  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 (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 5)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_9 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_9);
      __pyx_t_10 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_10);
      __pyx_t_11 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_11);
      __pyx_t_12 = PyTuple_GET_ITEM(tuple, 4); __Pyx_INCREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_child);
      __pyx_v_child = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_cxo);
      __pyx_v_cxo = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_v_cyo);
      __pyx_v_cyo = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_v_focus);
      __pyx_v_focus = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_v_main);
      __pyx_v_main = __pyx_t_12;
      __pyx_t_12 = 0;
    } else {
      __pyx_t_13 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_13, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = __Pyx_UnpackItem(__pyx_t_13, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_UnpackItem(__pyx_t_13, 2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_UnpackItem(__pyx_t_13, 3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_UnpackItem(__pyx_t_13, 4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_12);
      if (__Pyx_EndUnpack(__pyx_t_13, 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_v_child);
      __pyx_v_child = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_cxo);
      __pyx_v_cxo = __pyx_t_9;
      __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_v_cyo);
      __pyx_v_cyo = __pyx_t_10;
      __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_v_focus);
      __pyx_v_focus = __pyx_t_11;
      __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_v_main);
      __pyx_v_main = __pyx_t_12;
      __pyx_t_12 = 0;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":706
 *         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_7display_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_render_textures(__pyx_v_self, __pyx_v_child, __pyx_v_non_aligned, 0);

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":708
 *             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_7display_6gldraw_DISSOLVE);
    if (__pyx_t_7) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":709
 * 
 *             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) {

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":710
 *             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 = 710; __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 = 710; __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 = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_12 = PyObject_Call(__pyx_t_2, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L10;
      }
      __pyx_L10:;
      goto __pyx_L9;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":712
 *                     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_7display_6gldraw_IMAGEDISSOLVE);
    if (__pyx_t_7) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":713
 * 
 *             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 = 713; __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 = 713; __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 = 713; __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 = 713; __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 = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_11);
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10);
      __Pyx_GIVEREF(__pyx_t_10);
      __pyx_t_10 = 0;
      __pyx_t_10 = PyObject_Call(__pyx_t_12, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":714
 *             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_L9;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":716
 *                 first = False
 * 
 *             elif rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *                 p = rend.operation_parameter
 *                 pc = child
 */
    __pyx_t_7 = (__pyx_v_rend->operation == __pyx_v_5renpy_7display_6gldraw_PIXELLATE);
    if (__pyx_t_7) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":717
 * 
 *             elif rend.operation == PIXELLATE:
 *                 p = rend.operation_parameter             # <<<<<<<<<<<<<<
 *                 pc = child
 * 
 */
      __Pyx_INCREF(__pyx_v_rend->operation_parameter);
      __Pyx_DECREF(__pyx_v_p);
      __pyx_v_p = __pyx_v_rend->operation_parameter;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":718
 *             elif rend.operation == PIXELLATE:
 *                 p = rend.operation_parameter
 *                 pc = child             # <<<<<<<<<<<<<<
 * 
 *                 while p > 1:
 */
      __Pyx_INCREF(__pyx_v_child);
      __Pyx_DECREF(__pyx_v_pc);
      __pyx_v_pc = __pyx_v_child;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":720
 *                 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 = 720; __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 = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        if (!__pyx_t_7) break;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":721
 * 
 *                 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 = 721; __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;

        /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":722
 *                 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 = 722; __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 = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_INCREF(__pyx_v_pc);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_pc);
        __Pyx_GIVEREF(__pyx_v_pc);
        __pyx_t_12 = PyObject_Call(__pyx_t_10, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_v_pc);
        __pyx_v_pc = __pyx_t_12;
        __pyx_t_12 = 0;
      }
      goto __pyx_L9;
    }
    __pyx_L9:;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":724
 *                     pc = self.get_half(pc)
 * 
 *         if render_what:             # <<<<<<<<<<<<<<
 *             what.render_to_texture(True)
 * 
 */
  if (__pyx_v_render_what) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":725
 * 
 *         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 = 725; __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 = 725; __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 = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12);
    __Pyx_GIVEREF(__pyx_t_12);
    __pyx_t_12 = 0;
    __pyx_t_12 = PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 725; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    goto __pyx_L13;
  }
  __pyx_L13:;

  __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.display.gldraw.GLDraw.draw_render_textures");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_rend);
  __Pyx_DECREF(__pyx_v_child);
  __Pyx_DECREF(__pyx_v_cxo);
  __Pyx_DECREF(__pyx_v_cyo);
  __Pyx_DECREF(__pyx_v_focus);
  __Pyx_DECREF(__pyx_v_main);
  __Pyx_DECREF(__pyx_v_p);
  __Pyx_DECREF(__pyx_v_pc);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":677
 *         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_7display_6gldraw_6GLDraw_draw_render_textures(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_draw_render_textures[] = "\n        This is responsible for rendering things to textures,\n        as necessary.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_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;
  PyObject *__pyx_t_1 = NULL;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__non_aligned,0};
  __Pyx_RefNannySetupContext("draw_render_textures");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    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 = 677; __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 = 677; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __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 = 677; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_what = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_non_aligned = __Pyx_PyObject_IsTrue(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_non_aligned == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __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 = 677; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.draw_render_textures");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_render_textures(((struct __pyx_obj_5renpy_7display_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 = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.draw_render_textures");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":727
 *             what.render_to_texture(True)
 * 
 *     cpdef int draw_transformed(             # <<<<<<<<<<<<<<
 *         GLDraw self,
 *         object what,
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static  int __pyx_f_5renpy_7display_6gldraw_6GLDraw_draw_transformed(struct __pyx_obj_5renpy_7display_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, struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse, int __pyx_skip_dispatch) {
  struct __pyx_obj_5renpy_7display_6render_Render *__pyx_v_rend;
  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;
  PyObject *__pyx_v_tex;
  PyObject *__pyx_v_p;
  PyObject *__pyx_v_pc;
  PyObject *__pyx_v_minx;
  PyObject *__pyx_v_miny;
  PyObject *__pyx_v_maxx;
  PyObject *__pyx_v_maxy;
  PyObject *__pyx_v_tw;
  PyObject *__pyx_v_th;
  PyObject *__pyx_v_child;
  PyObject *__pyx_v_focus;
  PyObject *__pyx_v_main;
  int __pyx_r;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  double __pyx_t_9;
  int __pyx_t_10;
  double __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  __Pyx_RefNannySetupContext("draw_transformed");
  __Pyx_INCREF(__pyx_v_clip);
  __Pyx_INCREF((PyObject *)__pyx_v_reverse);
  __pyx_v_rend = ((struct __pyx_obj_5renpy_7display_6render_Render *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_child_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)Py_None); __Pyx_INCREF(Py_None);
  __pyx_v_tex = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_p = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_pc = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_minx = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_miny = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_maxx = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_maxy = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tw = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_th = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_child = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_focus = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_main = Py_None; __Pyx_INCREF(Py_None);
  /* 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 = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_transformed)) {
      __pyx_t_2 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __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 = 727; __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 = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_what);
      __Pyx_GIVEREF(__pyx_v_what);
      __Pyx_INCREF(((PyObject *)__pyx_v_clip));
      PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_clip));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_clip));
      PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_INCREF(((PyObject *)__pyx_v_reverse));
      PyTuple_SET_ITEM(__pyx_t_5, 5, ((PyObject *)__pyx_v_reverse));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_reverse));
      __pyx_t_2 = 0;
      __pyx_t_3 = 0;
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_r = __pyx_t_6;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":740
 *         cdef render.Matrix2D child_reverse
 * 
 *         if not isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, gltexture.TextureGrid):
 */
  __pyx_t_7 = PyObject_TypeCheck(__pyx_v_what, ((PyTypeObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render))); 
  __pyx_t_8 = (!__pyx_t_7);
  if (__pyx_t_8) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":742
 *         if not isinstance(what, render.Render):
 * 
 *             if isinstance(what, gltexture.TextureGrid):             # <<<<<<<<<<<<<<
 * 
 *                 self.set_clip(clip)
 */
    __pyx_t_8 = PyObject_TypeCheck(__pyx_v_what, ((PyTypeObject *)((PyObject*)__pyx_ptype_5renpy_7display_9gltexture_TextureGrid))); 
    if (__pyx_t_8) {

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

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":753
 *                     alpha,
 *                     self.environ,
 *                     False)             # <<<<<<<<<<<<<<
 * 
 *                 return 0
 */
      __pyx_t_1 = __pyx_f_5renpy_7display_9gltexture_blit(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_what), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_self->environ, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":755
 *                     False)
 * 
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(what, renpy.display.pgrender.opygame.Surface):
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":757
 *                 return 0
 * 
 *             if isinstance(what, renpy.display.pgrender.opygame.Surface):             # <<<<<<<<<<<<<<
 * 
 *                 tex = self.load_texture(what)
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__display); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__pgrender); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__opygame); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Surface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_8 = PyObject_IsInstance(__pyx_v_what, __pyx_t_1); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (__pyx_t_8) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":759
 *             if isinstance(what, renpy.display.pgrender.opygame.Surface):
 * 
 *                 tex = self.load_texture(what)             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, 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 = 759; __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 = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_what);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_what);
      __Pyx_GIVEREF(__pyx_v_what);
      __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __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_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_tex);
      __pyx_v_tex = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":760
 * 
 *                 tex = self.load_texture(what)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, reverse)             # <<<<<<<<<<<<<<
 *                 return 0
 * 
 */
      ((struct __pyx_vtabstruct_5renpy_7display_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_reverse, 0);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":761
 *                 tex = self.load_texture(what)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, reverse)
 *                 return 0             # <<<<<<<<<<<<<<
 * 
 *             raise Exception("Unknown drawing type. " + repr(what))
 */
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":763
 *                 return 0
 * 
 *             raise Exception("Unknown drawing type. " + repr(what))             # <<<<<<<<<<<<<<
 * 
 *         rend = what
 */
    __pyx_t_5 = PyObject_Repr(__pyx_v_what); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_42), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __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 = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":765
 *             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 = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_what);
  __Pyx_DECREF(((PyObject *)__pyx_v_rend));
  __pyx_v_rend = ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_what);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":769
 *         # Other draw modes.
 * 
 *         if rend.operation == DISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             if self.fast_dissolve:
 */
  __pyx_t_8 = (__pyx_v_rend->operation == __pyx_v_5renpy_7display_6gldraw_DISSOLVE);
  if (__pyx_t_8) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":771
 *         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) {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":777
 *                 # of dissolve on Ren'Py proper.
 * 
 *                 self.draw_transformed(rend.children[0][0],             # <<<<<<<<<<<<<<
 *                                       clip, xo, yo, alpha, reverse)
 * 
 */
      __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 = 777; __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 = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":778
 * 
 *                 self.draw_transformed(rend.children[0][0],
 *                                       clip, xo, yo, alpha, reverse)             # <<<<<<<<<<<<<<
 * 
 *                 self.draw_transformed(rend.children[1][0],
 */
      ((struct __pyx_vtabstruct_5renpy_7display_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_v_alpha, __pyx_v_reverse, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":780
 *                                       clip, xo, yo, alpha, reverse)
 * 
 *                 self.draw_transformed(rend.children[1][0],             # <<<<<<<<<<<<<<
 *                                       clip, xo, yo, alpha * what.operation_complete, reverse)
 * 
 */
      __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 = 780; __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 = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":781
 * 
 *                 self.draw_transformed(rend.children[1][0],
 *                                       clip, xo, yo, alpha * what.operation_complete, reverse)             # <<<<<<<<<<<<<<
 * 
 *             else:
 */
      __pyx_t_5 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__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_1 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_complete); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_v_self, __pyx_t_4, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_t_9, __pyx_v_reverse, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L7;
    }
    /*else*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":785
 *             else:
 * 
 *                 self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *                 gltexture.blend(
 */
      __pyx_t_4 = ((struct __pyx_vtabstruct_5renpy_7display_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 = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":788
 * 
 *                 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_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 = 788; __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 = 788; __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__render_to_texture); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __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_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __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 = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__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, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __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_1); __pyx_t_1 = 0;
      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":789
 *                 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 = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __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_5); __pyx_t_5 = 0;
      if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":795
 *                     alpha,
 *                     rend.operation_complete,
 *                     self.environ)             # <<<<<<<<<<<<<<
 * 
 *             return 0
 */
      __pyx_t_5 = __pyx_f_5renpy_7display_9gltexture_blend(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_t_3), ((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_t_4), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_rend->operation_complete, __pyx_v_self->environ, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __pyx_L7:;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":797
 *                     self.environ)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         elif rend.operation == IMAGEDISSOLVE:
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":799
 *             return 0
 * 
 *         elif rend.operation == IMAGEDISSOLVE:             # <<<<<<<<<<<<<<
 * 
 *             self.set_clip(clip)
 */
  __pyx_t_8 = (__pyx_v_rend->operation == __pyx_v_5renpy_7display_6gldraw_IMAGEDISSOLVE);
  if (__pyx_t_8) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":801
 *         elif rend.operation == IMAGEDISSOLVE:
 * 
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             gltexture.imageblend(
 */
    __pyx_t_5 = ((struct __pyx_vtabstruct_5renpy_7display_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 = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":804
 * 
 *             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_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 = 804; __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 = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__render_to_texture); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":805
 *             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_3 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __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_to_texture); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_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 = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":806
 *                 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_1 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __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_to_texture); 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_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__operation_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __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_2); __pyx_t_2 = 0;
    if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":812
 *                 alpha,
 *                 rend.operation_complete,
 *                 rend.operation_parameter,             # <<<<<<<<<<<<<<
 *                 self.environ)
 * 
 */
    __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_rend->operation_parameter); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":813
 *                 rend.operation_complete,
 *                 rend.operation_parameter,
 *                 self.environ)             # <<<<<<<<<<<<<<
 * 
 *             return 0
 */
    __pyx_t_2 = __pyx_f_5renpy_7display_9gltexture_imageblend(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_t_4), ((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_t_5), ((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_t_3), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_rend->operation_complete, __pyx_t_6, __pyx_v_self->environ, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":815
 *                 self.environ)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":818
 * 
 * 
 *         if rend.operation == PIXELLATE:             # <<<<<<<<<<<<<<
 *             self.set_clip(clip)
 * 
 */
  __pyx_t_8 = (__pyx_v_rend->operation == __pyx_v_5renpy_7display_6gldraw_PIXELLATE);
  if (__pyx_t_8) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":819
 * 
 *         if rend.operation == PIXELLATE:
 *             self.set_clip(clip)             # <<<<<<<<<<<<<<
 * 
 *             p = rend.operation_parameter
 */
    __pyx_t_2 = ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self->__pyx_vtab)->set_clip(__pyx_v_self, __pyx_v_clip, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":821
 *             self.set_clip(clip)
 * 
 *             p = rend.operation_parameter             # <<<<<<<<<<<<<<
 *             pc = rend.children[0][0]
 * 
 */
    __Pyx_INCREF(__pyx_v_rend->operation_parameter);
    __Pyx_DECREF(__pyx_v_p);
    __pyx_v_p = __pyx_v_rend->operation_parameter;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":822
 * 
 *             p = rend.operation_parameter
 *             pc = rend.children[0][0]             # <<<<<<<<<<<<<<
 * 
 *             while p > 1:
 */
    __pyx_t_2 = __Pyx_GetItemInt_List(((PyObject *)__pyx_v_rend->children), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_pc);
    __pyx_v_pc = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":824
 *             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 = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (!__pyx_t_8) break;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":825
 * 
 *             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 = 825; __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;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":826
 *             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 = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_pc);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pc);
      __Pyx_GIVEREF(__pyx_v_pc);
      __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_pc);
      __pyx_v_pc = __pyx_t_5;
      __pyx_t_5 = 0;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":828
 *                 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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__render); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __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__Matrix2D); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __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 = 828; __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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyNumber_Multiply(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__height); if (unlikely(!__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_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __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_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetAttr(__pyx_v_pc, __pyx_n_s__height); if (unlikely(!__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_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__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_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    __Pyx_INCREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0);
    __Pyx_GIVEREF(__pyx_int_0);
    PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_5 = 0;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__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_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_InPlaceMultiply(((PyObject *)__pyx_v_reverse), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(((PyObject *)__pyx_v_reverse));
    __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":831
 * 
 *             gltexture.blit(
 *                 pc,             # <<<<<<<<<<<<<<
 *                 xo,
 *                 yo,
 */
    if (!(likely(((__pyx_v_pc) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_pc, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":837
 *                 alpha,
 *                 self.environ,
 *                 True)             # <<<<<<<<<<<<<<
 * 
 *             return 0
 */
    __pyx_t_4 = __pyx_f_5renpy_7display_9gltexture_blit(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_pc), __pyx_v_xo, __pyx_v_yo, __pyx_v_reverse, __pyx_v_alpha, __pyx_v_self->environ, 1, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":839
 *                 True)
 * 
 *             return 0             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":843
 * 
 *         # Compute clipping.
 *         if rend.clipping:             # <<<<<<<<<<<<<<
 * 
 *             # Non-aligned clipping uses RTT.
 */
  if (__pyx_v_rend->clipping) {

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

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":847
 *             # Non-aligned clipping uses RTT.
 *             if reverse.ydx != 0 or reverse.xdy != 0:
 *                 tex = what.render_to_texture(True)             # <<<<<<<<<<<<<<
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, 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 = 847; __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 = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_tex);
      __pyx_v_tex = __pyx_t_3;
      __pyx_t_3 = 0;

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":848
 *             if reverse.ydx != 0 or reverse.xdy != 0:
 *                 tex = what.render_to_texture(True)
 *                 self.draw_transformed(tex, clip, xo, yo, alpha, reverse)             # <<<<<<<<<<<<<<
 *                 return 0
 * 
 */
      ((struct __pyx_vtabstruct_5renpy_7display_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_reverse, 0);

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

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":851
 *                 return 0
 * 
 *             minx, miny, maxx, maxy = clip             # <<<<<<<<<<<<<<
 * 
 *             # Figure out the transformed width and height of this
 */
    if (likely(((PyObject *)__pyx_v_clip) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_clip)) == 4)) {
      PyObject* tuple = ((PyObject *)__pyx_v_clip);
      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_v_minx);
      __pyx_v_minx = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_v_miny);
      __pyx_v_miny = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_maxx);
      __pyx_v_maxx = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_maxy);
      __pyx_v_maxy = __pyx_t_5;
      __pyx_t_5 = 0;
    } else {
      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_clip), 4);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":855
 *             # Figure out the transformed width and height of this
 *             # surface.
 *             tw, th = reverse.transform(what.width, what.height)             # <<<<<<<<<<<<<<
 * 
 *             minx = max(minx, min(xo, xo + tw))
 */
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = ((PyObject *)((struct __pyx_vtabstruct_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse->__pyx_vtab)->transform(__pyx_v_reverse, __pyx_t_9, __pyx_t_11, 0)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (likely(__pyx_t_5 != Py_None) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
      PyObject* tuple = __pyx_t_5;
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_v_tw);
      __pyx_v_tw = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_v_th);
      __pyx_v_th = __pyx_t_2;
      __pyx_t_2 = 0;
    } else {
      __Pyx_UnpackTupleError(__pyx_t_5, 2);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":857
 *             tw, th = reverse.transform(what.width, what.height)
 * 
 *             minx = max(minx, min(xo, xo + tw))             # <<<<<<<<<<<<<<
 *             maxx = min(maxx, max(xo, xo + tw))
 *             miny = max(miny, min(yo, yo + th))
 */
    __pyx_t_5 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_v_tw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_11 = __pyx_v_xo;
    __pyx_t_4 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = __pyx_t_2;
    } else {
      __pyx_t_3 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __pyx_t_3;
      __pyx_t_3 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_2 = __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_2, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = __pyx_t_2;
    } 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_2); __pyx_t_2 = 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;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":858
 * 
 *             minx = max(minx, min(xo, xo + tw))
 *             maxx = min(maxx, max(xo, xo + tw))             # <<<<<<<<<<<<<<
 *             miny = max(miny, min(yo, yo + th))
 *             maxy = min(maxy, max(yo, yo + th))
 */
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_xo); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_tw); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_11 = __pyx_v_xo;
    __pyx_t_5 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = PyObject_RichCompare(__pyx_t_2, __pyx_t_5, Py_GT); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_3 = __pyx_t_2;
    } else {
      __pyx_t_4 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_3 = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_2 = __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_2, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = __pyx_t_2;
    } 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_2); __pyx_t_2 = 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;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":859
 *             minx = max(minx, min(xo, xo + tw))
 *             maxx = min(maxx, max(xo, xo + tw))
 *             miny = max(miny, min(yo, yo + th))             # <<<<<<<<<<<<<<
 *             maxy = min(maxy, max(yo, yo + th))
 * 
 */
    __pyx_t_4 = PyFloat_FromDouble(__pyx_v_yo); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_v_th); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_11 = __pyx_v_yo;
    __pyx_t_3 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = __pyx_t_2;
    } else {
      __pyx_t_5 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_2 = __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_2, __pyx_t_4, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_10) {
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_5 = __pyx_t_2;
    } 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_2); __pyx_t_2 = 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;

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

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":862
 *             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 = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__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);
    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_clip));
    __pyx_v_clip = ((PyObject *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L11;
  }
  __pyx_L11:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":864
 *             clip = (minx, miny, maxx, maxy)
 * 
 *         alpha = alpha * rend.alpha             # <<<<<<<<<<<<<<
 * 
 *         # If our alpha has hit 0, don't do anything.
 */
  __pyx_v_alpha = (__pyx_v_alpha * __pyx_v_rend->alpha);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":867
 * 
 *         # If our alpha has hit 0, don't do anything.
 *         if alpha <= 0.003: # (1 / 256)             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
  __pyx_t_10 = (__pyx_v_alpha <= 0.003);
  if (__pyx_t_10) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":868
 *         # 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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":870
 *             return 0
 * 
 *         if rend.reverse is not None and rend.reverse is not IDENTITY:             # <<<<<<<<<<<<<<
 *             child_reverse = rend.reverse * reverse
 *         else:
 */
  __pyx_t_10 = (((PyObject *)__pyx_v_rend->reverse) != Py_None);
  if (__pyx_t_10) {
    __pyx_t_8 = (((PyObject *)__pyx_v_rend->reverse) != __pyx_v_5renpy_7display_6gldraw_IDENTITY);
    __pyx_t_7 = __pyx_t_8;
  } else {
    __pyx_t_7 = __pyx_t_10;
  }
  if (__pyx_t_7) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":871
 * 
 *         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 = 871; __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 = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(((PyObject *)__pyx_v_child_reverse));
    __pyx_v_child_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L14;
  }
  /*else*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":873
 *             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_DECREF(((PyObject *)__pyx_v_child_reverse));
    __pyx_v_child_reverse = __pyx_v_reverse;
  }
  __pyx_L14:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":875
 *             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 (likely(((PyObject *)__pyx_v_rend->visible_children) != Py_None)) {
    __pyx_t_12 = 0; __pyx_t_3 = ((PyObject *)__pyx_v_rend->visible_children); __Pyx_INCREF(__pyx_t_3);
  } else {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (__pyx_t_12 >= PyList_GET_SIZE(__pyx_t_3)) break;
    __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_12); __Pyx_INCREF(__pyx_t_2); __pyx_t_12++;
    if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 5)) {
      PyObject* tuple = __pyx_t_2;
      __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_1);
      __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_13);
      __pyx_t_14 = PyTuple_GET_ITEM(tuple, 4); __Pyx_INCREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_v_child);
      __pyx_v_child = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_cxo = __pyx_t_11;
      __pyx_v_cyo = __pyx_t_9;
      __Pyx_DECREF(__pyx_v_focus);
      __pyx_v_focus = __pyx_t_13;
      __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_v_main);
      __pyx_v_main = __pyx_t_14;
      __pyx_t_14 = 0;
    } else {
      __pyx_t_15 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_15, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_15, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_15, 2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_13 = __Pyx_UnpackItem(__pyx_t_15, 3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = __Pyx_UnpackItem(__pyx_t_15, 4); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_14);
      if (__Pyx_EndUnpack(__pyx_t_15, 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_DECREF(__pyx_v_child);
      __pyx_v_child = __pyx_t_5;
      __pyx_t_5 = 0;
      __pyx_v_cxo = __pyx_t_9;
      __pyx_v_cyo = __pyx_t_11;
      __Pyx_DECREF(__pyx_v_focus);
      __pyx_v_focus = __pyx_t_13;
      __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_v_main);
      __pyx_v_main = __pyx_t_14;
      __pyx_t_14 = 0;
    }

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":876
 * 
 *         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));

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

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":879
 *             tcyo = reverse.ydx * cxo + reverse.ydy * cyo
 * 
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, child_reverse)             # <<<<<<<<<<<<<<
 * 
 *         return 0
 */
    ((struct __pyx_vtabstruct_5renpy_7display_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_child_reverse, 0);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":881
 *             self.draw_transformed(child, clip, xo + tcxo, yo + tcyo, alpha, 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_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_WriteUnraisable("renpy.display.gldraw.GLDraw.draw_transformed");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_DECREF((PyObject *)__pyx_v_rend);
  __Pyx_DECREF((PyObject *)__pyx_v_child_reverse);
  __Pyx_DECREF(__pyx_v_tex);
  __Pyx_DECREF(__pyx_v_p);
  __Pyx_DECREF(__pyx_v_pc);
  __Pyx_DECREF(__pyx_v_minx);
  __Pyx_DECREF(__pyx_v_miny);
  __Pyx_DECREF(__pyx_v_maxx);
  __Pyx_DECREF(__pyx_v_maxy);
  __Pyx_DECREF(__pyx_v_tw);
  __Pyx_DECREF(__pyx_v_th);
  __Pyx_DECREF(__pyx_v_child);
  __Pyx_DECREF(__pyx_v_focus);
  __Pyx_DECREF(__pyx_v_main);
  __Pyx_DECREF(__pyx_v_clip);
  __Pyx_DECREF((PyObject *)__pyx_v_reverse);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":727
 *             what.render_to_texture(True)
 * 
 *     cpdef int draw_transformed(             # <<<<<<<<<<<<<<
 *         GLDraw self,
 *         object what,
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_transformed(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_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;
  struct __pyx_obj_5renpy_7display_6render_Matrix2D *__pyx_v_reverse = 0;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  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__reverse,0};
  __Pyx_RefNannySetupContext("draw_transformed");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[6] = {0,0,0,0,0,0};
    switch (PyTuple_GET_SIZE(__pyx_args)) {
      case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      case  0: break;
      default: goto __pyx_L5_argtuple_error;
    }
    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, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __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, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __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, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __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, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      case  5:
      values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reverse);
      if (likely(values[5])) kw_args--;
      else {
        __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __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 = 727; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __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 = 731; __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 = 732; __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 = 733; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)values[5]);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_what = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_clip = ((PyObject *)PyTuple_GET_ITEM(__pyx_args, 1));
    __pyx_v_xo = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_xo == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_yo = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_yo == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_reverse = ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)PyTuple_GET_ITEM(__pyx_args, 5));
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("draw_transformed", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.draw_transformed");
  __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 = 730; __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 = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_clip, __pyx_v_xo, __pyx_v_yo, __pyx_v_alpha, __pyx_v_reverse, 1)); 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_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.draw_transformed");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":889
 *         forward = reverse = IDENTITY
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6gldraw_17render_to_texture_draw_func = {__Pyx_NAMESTR("draw_func"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_17render_to_texture_draw_func, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6gldraw_17render_to_texture_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_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;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  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_7display_6gldraw___pyx_scope_struct_render_to_texture *)__pyx_self;
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    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;
    }
    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 = 889; __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 = 889; __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 = 889; __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 = 889; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_y = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_w = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_h = PyTuple_GET_ITEM(__pyx_args, 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 = 889; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.render_to_texture.draw_func");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_clip = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":891
 *         def draw_func(x, y, w, h):
 * 
 *             self.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             if alpha:
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_outer_scope->__pyx_v_self), __pyx_n_s__clip_mode_rtt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __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_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":893
 *             self.clip_mode_rtt(x, y, w, h)
 * 
 *             if alpha:             # <<<<<<<<<<<<<<
 *                 glClearColor(0.0, 0.0, 0.0, 0.0)
 *             else:
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_outer_scope->__pyx_v_alpha); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":894
 * 
 *             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*/ {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":896
 *                 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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":898
 *                 glClearColor(0.0, 0.0, 0.0, 1.0)
 * 
 *             glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *             clip = (0, 0, what.width, what.height)
 */
  glClear(GL_COLOR_BUFFER_BIT);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":900
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             clip = (0, 0, what.width, what.height)             # <<<<<<<<<<<<<<
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, reverse)
 */
  __pyx_t_3 = PyObject_GetAttr(__pyx_outer_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyObject_GetAttr(__pyx_outer_scope->__pyx_v_what, __pyx_n_s__height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __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 = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __pyx_t_2 = 0;
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_clip));
  __pyx_v_clip = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":902
 *             clip = (0, 0, what.width, what.height)
 * 
 *             self.draw_transformed(what, clip, 0, 0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(what, render.Render):
 */
  if (!(likely(((__pyx_outer_scope->__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_outer_scope->__pyx_v_reverse, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)__pyx_outer_scope->__pyx_v_self->__pyx_vtab)->draw_transformed(__pyx_outer_scope->__pyx_v_self, __pyx_outer_scope->__pyx_v_what, __pyx_v_clip, 0.0, 0.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_outer_scope->__pyx_v_reverse), 0);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.display.gldraw.render_to_texture.draw_func");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_clip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":883
 *         return 0
 * 
 *     def render_to_texture(self_, what, alpha):             # <<<<<<<<<<<<<<
 * 
 *         cdef GLDraw self = self_
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_render_to_texture(PyObject *__pyx_v_self_, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_render_to_texture(PyObject *__pyx_v_self_, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *__pyx_cur_scope;
  PyObject *__pyx_v_forward;
  PyObject *__pyx_v_draw_func;
  PyObject *__pyx_v_rv;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  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_7display_6gldraw___pyx_scope_struct_render_to_texture *)__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture->tp_new(__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    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 = 883; __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 = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_cur_scope->__pyx_v_what = values[0];
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
    __pyx_cur_scope->__pyx_v_alpha = values[1];
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alpha);
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_cur_scope->__pyx_v_what = PyTuple_GET_ITEM(__pyx_args, 0);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
    __pyx_cur_scope->__pyx_v_alpha = PyTuple_GET_ITEM(__pyx_args, 1);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_alpha);
  }
  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 = 883; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.render_to_texture");
  __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_v_forward = Py_None; __Pyx_INCREF(Py_None);
  __pyx_cur_scope->__pyx_v_reverse = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_draw_func = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_rv = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":885
 *     def render_to_texture(self_, what, alpha):
 * 
 *         cdef GLDraw self = self_             # <<<<<<<<<<<<<<
 * 
 *         forward = reverse = IDENTITY
 */
  __Pyx_INCREF(__pyx_v_self_);
  __pyx_cur_scope->__pyx_v_self = ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self_);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":887
 *         cdef GLDraw self = self_
 * 
 *         forward = reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         def draw_func(x, y, w, h):
 */
  __Pyx_INCREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_v_forward);
  __pyx_v_forward = __pyx_v_5renpy_7display_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_reverse);
  __pyx_cur_scope->__pyx_v_reverse = __pyx_v_5renpy_7display_6gldraw_IDENTITY;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":889
 *         forward = reverse = IDENTITY
 * 
 *         def draw_func(x, y, w, h):             # <<<<<<<<<<<<<<
 * 
 *             self.clip_mode_rtt(x, y, w, h)
 */
  __pyx_t_1 = __pyx_binding_PyCFunctionType_New(&__pyx_mdef_5renpy_7display_6gldraw_17render_to_texture_draw_func, ((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_v_draw_func);
  __pyx_v_draw_func = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":904
 *             self.draw_transformed(what, clip, 0, 0, 1.0, reverse)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  __pyx_t_2 = PyObject_TypeCheck(__pyx_cur_scope->__pyx_v_what, ((PyTypeObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render))); 
  if (__pyx_t_2) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":905
 * 
 *         if isinstance(what, render.Render):
 *             what.is_opaque()             # <<<<<<<<<<<<<<
 * 
 *         self.upscale_factor = 1.0
 */
    __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 = 905; __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 = 905; __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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":907
 *             what.is_opaque()
 * 
 *         self.upscale_factor = 1.0             # <<<<<<<<<<<<<<
 * 
 *         rv = gltexture.texture_grid_from_drawing(what.width, what.height, draw_func, self.rtt)
 */
  __pyx_cur_scope->__pyx_v_self->upscale_factor = 1.0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":909
 *         self.upscale_factor = 1.0
 * 
 *         rv = gltexture.texture_grid_from_drawing(what.width, what.height, draw_func, self.rtt)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s_43); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __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_cur_scope->__pyx_v_what, __pyx_n_s__width); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __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 = 909; __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 = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  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_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_v_rv);
  __pyx_v_rv = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":911
 *         rv = gltexture.texture_grid_from_drawing(what.width, what.height, draw_func, self.rtt)
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_rv);
  __pyx_r = __pyx_v_rv;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.render_to_texture");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_DECREF(__pyx_v_forward);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_reverse);
  __Pyx_DECREF(__pyx_v_draw_func);
  __Pyx_DECREF(__pyx_v_rv);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_alpha);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":914
 * 
 * 
 *     def is_pixel_opaque(self, what, x, y):             # <<<<<<<<<<<<<<
 *         """
 *         Returns true if the pixel is not 100% transparent.
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_is_pixel_opaque(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_is_pixel_opaque[] = "\n        Returns true if the pixel is not 100% transparent.\n        ";
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_is_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;
  PyObject *__pyx_v_reverse;
  PyObject *__pyx_v_clip;
  unsigned char __pyx_v_a;
  PyObject *__pyx_r = NULL;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__what,&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("is_pixel_opaque");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[3] = {0,0,0};
    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;
    }
    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 = 914; __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 = 914; __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 = 914; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_what = values[0];
    __pyx_v_x = values[1];
    __pyx_v_y = values[2];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_what = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_y = PyTuple_GET_ITEM(__pyx_args, 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 = 914; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.is_pixel_opaque");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_what);
  __pyx_v_forward = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_reverse = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_clip = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":919
 *         """
 * 
 *         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 = 919; __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 = 919; __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 = 919; __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 = 919; __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 = 919; __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 = 919; __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 = 919; __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 = 919; __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 = 919; __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 = 919; __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) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":920
 * 
 *         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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":922
 *             return 0
 * 
 *         if self.always_opaque:             # <<<<<<<<<<<<<<
 *             return 255
 * 
 */
  if (((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->always_opaque) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":923
 * 
 *         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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":925
 *             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 = 925; __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 = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __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_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_v_what);
  __pyx_v_what = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":927
 *         what = what.subsurface((x, y, 1, 1))
 * 
 *         forward = reverse = IDENTITY             # <<<<<<<<<<<<<<
 * 
 *         glViewport(0, 0, 1, 1)
 */
  __Pyx_INCREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_v_forward);
  __pyx_v_forward = __pyx_v_5renpy_7display_6gldraw_IDENTITY;
  __Pyx_INCREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_v_reverse);
  __pyx_v_reverse = __pyx_v_5renpy_7display_6gldraw_IDENTITY;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":929
 *         forward = reverse = IDENTITY
 * 
 *         glViewport(0, 0, 1, 1)             # <<<<<<<<<<<<<<
 *         glClearColor(0.0, 0.0, 0.0, 0.0)
 * 
 */
  glViewport(0, 0, 1, 1);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":930
 * 
 *         glViewport(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);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":932
 *         glClearColor(0.0, 0.0, 0.0, 0.0)
 * 
 *         glClear(GL_COLOR_BUFFER_BIT)             # <<<<<<<<<<<<<<
 * 
 *         glMatrixMode(GL_PROJECTION)
 */
  glClear(GL_COLOR_BUFFER_BIT);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":934
 *         glClear(GL_COLOR_BUFFER_BIT)
 * 
 *         glMatrixMode(GL_PROJECTION)             # <<<<<<<<<<<<<<
 *         glLoadIdentity()
 *         glOrtho(0, 1, 0, 1, -1, 1)
 */
  glMatrixMode(GL_PROJECTION);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":935
 * 
 *         glMatrixMode(GL_PROJECTION)
 *         glLoadIdentity()             # <<<<<<<<<<<<<<
 *         glOrtho(0, 1, 0, 1, -1, 1)
 *         glMatrixMode(GL_MODELVIEW)
 */
  glLoadIdentity();

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":936
 *         glMatrixMode(GL_PROJECTION)
 *         glLoadIdentity()
 *         glOrtho(0, 1, 0, 1, -1, 1)             # <<<<<<<<<<<<<<
 *         glMatrixMode(GL_MODELVIEW)
 * 
 */
  glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":937
 *         glLoadIdentity()
 *         glOrtho(0, 1, 0, 1, -1, 1)
 *         glMatrixMode(GL_MODELVIEW)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_rtt(0, 0, 1, 1)
 */
  glMatrixMode(GL_MODELVIEW);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":939
 *         glMatrixMode(GL_MODELVIEW)
 * 
 *         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 = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_8 = PyTuple_New(4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; __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_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":941
 *         self.clip_mode_rtt(0, 0, 1, 1)
 * 
 *         clip = (0, 0, 1, 1)             # <<<<<<<<<<<<<<
 * 
 *         self.draw_transformed(what, clip, 0, 0, 1.0, reverse)
 */
  __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_clip));
  __pyx_v_clip = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":943
 *         clip = (0, 0, 1, 1)
 * 
 *         self.draw_transformed(what, clip, 0, 0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         cdef unsigned char a = 0
 */
  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 = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->draw_transformed(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self), __pyx_v_what, __pyx_v_clip, 0.0, 0.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_reverse), 0);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":945
 *         self.draw_transformed(what, clip, 0, 0, 1.0, reverse)
 * 
 *         cdef unsigned char a = 0             # <<<<<<<<<<<<<<
 * 
 *         glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_BYTE, &a)
 */
  __pyx_v_a = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":947
 *         cdef unsigned char a = 0
 * 
 *         glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_BYTE, &a)             # <<<<<<<<<<<<<<
 * 
 *         what.kill()
 */
  glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_BYTE, (&__pyx_v_a));

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":949
 *         glReadPixels(0, 0, 1, 1, GL_ALPHA, GL_BYTE, &a)
 * 
 *         what.kill()             # <<<<<<<<<<<<<<
 * 
 *         return a
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_what, __pyx_n_s__kill); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":951
 *         what.kill()
 * 
 *         return a             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = PyInt_FromLong(__pyx_v_a); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.is_pixel_opaque");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_forward);
  __Pyx_DECREF(__pyx_v_reverse);
  __Pyx_DECREF(__pyx_v_clip);
  __Pyx_DECREF(__pyx_v_what);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":971
 *         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_7display_6gldraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5renpy_7display_6gldraw_8get_half_draw_func = {__Pyx_NAMESTR("draw_func"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_8get_half_draw_func, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_5renpy_7display_6gldraw_8get_half_draw_func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_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;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  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_7display_6gldraw___pyx_scope_struct_get_half *)__pyx_self;
  __pyx_self = __pyx_self;
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[4] = {0,0,0,0};
    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;
    }
    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 = 971; __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 = 971; __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 = 971; __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 = 971; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
    __pyx_v_w = values[2];
    __pyx_v_h = values[3];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_y = PyTuple_GET_ITEM(__pyx_args, 1);
    __pyx_v_w = PyTuple_GET_ITEM(__pyx_args, 2);
    __pyx_v_h = PyTuple_GET_ITEM(__pyx_args, 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 = 971; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.get_half.draw_func");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_v_clip = ((PyObject *)Py_None); __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":973
 *         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);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":974
 * 
 *             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);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":976
 *             glClear(GL_COLOR_BUFFER_BIT)
 * 
 *             draw.clip_mode_rtt(x, y, w, h)             # <<<<<<<<<<<<<<
 * 
 *             clip = (0, 0, width, height)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_outer_scope->__pyx_v_draw), __pyx_n_s__clip_mode_rtt); 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_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __Pyx_INCREF(__pyx_v_w);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_w);
  __Pyx_GIVEREF(__pyx_v_w);
  __Pyx_INCREF(__pyx_v_h);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_h);
  __Pyx_GIVEREF(__pyx_v_h);
  __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":978
 *             draw.clip_mode_rtt(x, y, w, h)
 * 
 *             clip = (0, 0, width, height)             # <<<<<<<<<<<<<<
 * 
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, reverse)
 */
  __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_outer_scope->__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_outer_scope->__pyx_v_width);
  __Pyx_GIVEREF(__pyx_outer_scope->__pyx_v_width);
  __Pyx_INCREF(__pyx_outer_scope->__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_outer_scope->__pyx_v_height);
  __Pyx_GIVEREF(__pyx_outer_scope->__pyx_v_height);
  if (!(likely(PyTuple_CheckExact(__pyx_t_3))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_v_clip));
  __pyx_v_clip = ((PyObject *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":980
 *             clip = (0, 0, width, height)
 * 
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, reverse)             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(what, render.Render):
 */
  if (!(likely(((__pyx_outer_scope->__pyx_v_reverse) == Py_None) || likely(__Pyx_TypeTest(__pyx_outer_scope->__pyx_v_reverse, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)__pyx_outer_scope->__pyx_v_draw->__pyx_vtab)->draw_transformed(__pyx_outer_scope->__pyx_v_draw, __pyx_outer_scope->__pyx_v_what, __pyx_v_clip, 0.0, 0.0, 1.0, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_outer_scope->__pyx_v_reverse), 0);

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("renpy.display.gldraw.get_half.draw_func");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_clip);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":954
 * 
 * 
 *     def get_half(self, what):             # <<<<<<<<<<<<<<
 *         """
 *         Gets a texture grid that's half the size of what..
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what); /*proto*/
static char __pyx_doc_5renpy_7display_6gldraw_6GLDraw_get_half[] = "\n        Gets a texture grid that's half the size of what..\n        ";
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_get_half(PyObject *__pyx_v_self, PyObject *__pyx_v_what) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *__pyx_cur_scope;
  PyObject *__pyx_v_forward;
  PyObject *__pyx_v_draw_func;
  PyObject *__pyx_v_rv;
  PyObject *__pyx_r = NULL;
  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;
  __Pyx_RefNannySetupContext("get_half");
  __pyx_cur_scope = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *)__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_get_half->tp_new(__pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_get_half, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_what = __pyx_v_what;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_what);
  __pyx_cur_scope->__pyx_v_reverse = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_forward = Py_None; __Pyx_INCREF(Py_None);
  __pyx_cur_scope->__pyx_v_width = Py_None; __Pyx_INCREF(Py_None);
  __pyx_cur_scope->__pyx_v_height = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_draw_func = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_rv = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":960
 *         # 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_cur_scope->__pyx_v_draw = ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":962
 *         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 = 962; __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 = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":963
 * 
 *         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 = 963; __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:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":965
 *             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 = 965; __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 = 965; __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 = 965; __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 = 965; __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 = 965; __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 = 965; __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 = 965; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 965; __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_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_cur_scope->__pyx_v_reverse);
  __pyx_cur_scope->__pyx_v_reverse = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":966
 * 
 *         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 = 966; __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 = 966; __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 = 966; __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 = 966; __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 = 966; __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 = 966; __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 = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_4 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_forward);
  __pyx_v_forward = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":968
 *         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 = 968; __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 = 968; __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 = 968; __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 = 968; __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 = 968; __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 = 968; __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_DECREF(__pyx_cur_scope->__pyx_v_width);
  __pyx_cur_scope->__pyx_v_width = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":969
 * 
 *         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 = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = PyInt_FromLong(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyObject_RichCompare(__pyx_t_4, __pyx_t_1, Py_GT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_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 = 969; __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 = 969; __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_DECREF(__pyx_cur_scope->__pyx_v_height);
  __pyx_cur_scope->__pyx_v_height = __pyx_t_3;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":971
 *         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_New(&__pyx_mdef_5renpy_7display_6gldraw_8get_half_draw_func, ((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_v_draw_func);
  __pyx_v_draw_func = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":982
 *             draw.draw_transformed(what, clip, 0, 0, 1.0, reverse)
 * 
 *         if isinstance(what, render.Render):             # <<<<<<<<<<<<<<
 *             what.is_opaque()
 * 
 */
  __pyx_t_2 = PyObject_TypeCheck(__pyx_cur_scope->__pyx_v_what, ((PyTypeObject *)((PyObject*)__pyx_ptype_5renpy_7display_6render_Render))); 
  if (__pyx_t_2) {

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":985
 *             what.is_opaque()
 * 
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt)             # <<<<<<<<<<<<<<
 * 
 *         what.half_cache = rv
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gltexture); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s_43); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __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(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_width);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_width);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_height);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_height);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
  __Pyx_INCREF(__pyx_v_draw_func);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_draw_func);
  __Pyx_GIVEREF(__pyx_v_draw_func);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
  PyTuple_SET_ITEM(__pyx_t_1, 3, ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
  __Pyx_GIVEREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->rtt);
  __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 985; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_rv);
  __pyx_v_rv = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":987
 *         rv = gltexture.texture_grid_from_drawing(width, height, draw_func, self.rtt)
 * 
 *         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 = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":989
 *         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.display.gldraw.GLDraw.get_half");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_draw);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_reverse);
  __Pyx_DECREF(__pyx_v_forward);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_width);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_height);
  __Pyx_DECREF(__pyx_v_draw_func);
  __Pyx_DECREF(__pyx_v_rv);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_what);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":991
 *         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_7display_6gldraw_6GLDraw_update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_update_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("update_mouse");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":995
 *         # 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;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":997
 *         return
 * 
 *     def translate_mouse(self, x, y):             # <<<<<<<<<<<<<<
 * 
 *         # Screen sizes.
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_translate_mouse(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_translate_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;
  PyObject *__pyx_v_ph;
  PyObject *__pyx_v_vw;
  PyObject *__pyx_v_vh;
  PyObject *__pyx_v_vx;
  PyObject *__pyx_v_vy;
  PyObject *__pyx_v_vbw;
  PyObject *__pyx_v_vbh;
  PyObject *__pyx_r = NULL;
  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;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,0};
  __Pyx_RefNannySetupContext("translate_mouse");
  if (unlikely(__pyx_kwds)) {
    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
    PyObject* values[2] = {0,0};
    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;
    }
    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 = 997; __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 = 997; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    }
    __pyx_v_x = values[0];
    __pyx_v_y = values[1];
  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
    goto __pyx_L5_argtuple_error;
  } else {
    __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0);
    __pyx_v_y = PyTuple_GET_ITEM(__pyx_args, 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 = 997; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.translate_mouse");
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __Pyx_INCREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  __pyx_v_pw = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ph = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vw = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vh = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vx = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vy = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vbw = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_vbh = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1000
 * 
 *         # Screen sizes.
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box
 */
  if (likely(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size)) == 2)) {
    PyObject* tuple = ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_pw);
    __pyx_v_pw = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_ph);
    __pyx_v_ph = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1001
 *         # Screen sizes.
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size             # <<<<<<<<<<<<<<
 *         vx, vy, vbw, vbh = self.virtual_box
 * 
 */
  if (likely(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size)) == 2)) {
    PyObject* tuple = ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size);
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_vw);
    __pyx_v_vw = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_vh);
    __pyx_v_vh = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_size), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1001; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1002
 *         pw, ph = self.physical_size
 *         vw, vh = self.virtual_size
 *         vx, vy, vbw, vbh = self.virtual_box             # <<<<<<<<<<<<<<
 * 
 *         # Translate to fractional screen.
 */
  if (likely(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_box) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_box)) == 4)) {
    PyObject* tuple = ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_box);
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_v_vx);
    __pyx_v_vx = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_vy);
    __pyx_v_vy = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_vbw);
    __pyx_v_vbw = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_vbh);
    __pyx_v_vbh = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->virtual_box), 4);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1005
 * 
 *         # 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 = 1005; __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 = 1005; __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 = 1005; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1006
 *         # 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 = 1006; __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 = 1006; __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 = 1006; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1009
 * 
 *         # 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 = 1009; __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 = 1009; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1010
 *         # 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 = 1010; __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 = 1010; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1012
 *         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 = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1013
 * 
 *         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 = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__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)), __pyx_t_3, NULL); 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_y);
  __pyx_v_y = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1015
 *         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 = 1015; __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 = 1015; __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 = 1015; __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 = 1015; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1016
 * 
 *         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 = 1016; __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 = 1016; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1017
 *         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 = 1017; __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 = 1017; __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 = 1017; __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 = 1017; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1018
 *         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 = 1018; __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 = 1018; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1020
 *         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 = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_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.display.gldraw.GLDraw.translate_mouse");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_pw);
  __Pyx_DECREF(__pyx_v_ph);
  __Pyx_DECREF(__pyx_v_vw);
  __Pyx_DECREF(__pyx_v_vh);
  __Pyx_DECREF(__pyx_v_vx);
  __Pyx_DECREF(__pyx_v_vy);
  __Pyx_DECREF(__pyx_v_vbw);
  __Pyx_DECREF(__pyx_v_vbh);
  __Pyx_DECREF(__pyx_v_x);
  __Pyx_DECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1022
 *         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_7display_6gldraw_6GLDraw_mouse_event(PyObject *__pyx_v_self, PyObject *__pyx_v_ev); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_mouse_event(PyObject *__pyx_v_self, PyObject *__pyx_v_ev) {
  PyObject *__pyx_v_x;
  PyObject *__pyx_v_y;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("mouse_event");
  __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_y = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1023
 * 
 *     def mouse_event(self, ev):
 *         x, y = getattr(ev, 'pos', 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 = 1023; __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 = 1023; __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 = 1023; __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 = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetAttr3(__pyx_v_ev, ((PyObject *)__pyx_n_s__pos), __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_x);
    __pyx_v_x = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); 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_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_x);
    __pyx_v_x = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1024
 *     def mouse_event(self, ev):
 *         x, y = getattr(ev, 'pos', pygame.mouse.get_pos())
 *         return self.translate_mouse(x, y)             # <<<<<<<<<<<<<<
 * 
 *     def get_mouse_pos(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__translate_mouse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __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 = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__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.display.gldraw.GLDraw.mouse_event");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_x);
  __Pyx_DECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1026
 *         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_7display_6gldraw_6GLDraw_get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_get_mouse_pos(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_x;
  PyObject *__pyx_v_y;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  __Pyx_RefNannySetupContext("get_mouse_pos");
  __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_y = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1027
 * 
 *     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 = 1027; __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 = 1027; __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 = 1027; __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 = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) {
    PyObject* tuple = __pyx_t_2;
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_x);
    __pyx_v_x = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_EndUnpack(__pyx_t_4, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1027; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_x);
    __pyx_v_x = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_t_3;
    __pyx_t_3 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1028
 *     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 = 1028; __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 = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_x);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x);
  __Pyx_GIVEREF(__pyx_v_x);
  __Pyx_INCREF(__pyx_v_y);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_y);
  __Pyx_GIVEREF(__pyx_v_y);
  __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.get_mouse_pos");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_x);
  __Pyx_DECREF(__pyx_v_y);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1032
 * 
 *     # Private.
 *     def draw_mouse(self):             # <<<<<<<<<<<<<<
 * 
 *         hardware, mx, my, tex = renpy.game.interface.get_mouse_info()
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_mouse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_v_hardware;
  PyObject *__pyx_v_mx;
  PyObject *__pyx_v_my;
  PyObject *__pyx_v_tex;
  PyObject *__pyx_v_x;
  PyObject *__pyx_v_y;
  PyObject *__pyx_v_pw;
  PyObject *__pyx_v_ph;
  PyObject *__pyx_r = NULL;
  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;
  GLsizei __pyx_t_9;
  GLsizei __pyx_t_10;
  GLdouble __pyx_t_11;
  GLdouble __pyx_t_12;
  double __pyx_t_13;
  double __pyx_t_14;
  __Pyx_RefNannySetupContext("draw_mouse");
  __pyx_v_hardware = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_mx = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_my = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_tex = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_x = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_y = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_pw = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_ph = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1034
 *     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 = 1034; __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 = 1034; __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 = 1034; __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 = 1034; __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 = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 4)) {
    PyObject* tuple = __pyx_t_1;
    __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 2); __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 3); __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_v_hardware);
    __pyx_v_hardware = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_mx);
    __pyx_v_mx = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_my);
    __pyx_v_my = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_tex);
    __pyx_v_tex = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_6, 2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_6, 3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_EndUnpack(__pyx_t_6, 4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_v_hardware);
    __pyx_v_hardware = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_v_mx);
    __pyx_v_mx = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_my);
    __pyx_v_my = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_tex);
    __pyx_v_tex = __pyx_t_5;
    __pyx_t_5 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1036
 *         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 = 1036; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_mx);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mx);
  __Pyx_GIVEREF(__pyx_v_mx);
  __Pyx_INCREF(__pyx_v_my);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_my);
  __Pyx_GIVEREF(__pyx_v_my);
  __Pyx_INCREF(__pyx_v_tex);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_tex);
  __Pyx_GIVEREF(__pyx_v_tex);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_info = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1038
 *         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_7display_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 = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1039
 * 
 *         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 = 1039; __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 = 1039; __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 = 1039; __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 = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_hardware);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_hardware);
    __Pyx_GIVEREF(__pyx_v_hardware);
    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1040
 *         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_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
    __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible);
    ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->mouse_old_visible = __pyx_v_hardware;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1042
 *             self.mouse_old_visible = hardware
 * 
 *         if not tex:             # <<<<<<<<<<<<<<
 *             return
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_tex); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = (!__pyx_t_7);
  if (__pyx_t_8) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1043
 * 
 *         if not tex:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         x, y = pygame.mouse.get_pos()
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1045
 *             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 = 1045; __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 = 1045; __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 = 1045; __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 = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) {
    PyObject* tuple = __pyx_t_5;
    __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_x);
    __pyx_v_x = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_3, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_3, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__Pyx_EndUnpack(__pyx_t_3, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_v_x);
    __pyx_v_x = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_v_y);
    __pyx_v_y = __pyx_t_1;
    __pyx_t_1 = 0;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1047
 *         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 = 1047; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1048
 * 
 *         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 = 1048; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1050
 *         y -= my
 * 
 *         pw, ph = self.physical_size             # <<<<<<<<<<<<<<
 * 
 *         glViewport(0, 0, pw, ph)
 */
  if (likely(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size)) == 2)) {
    PyObject* tuple = ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
    __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_pw);
    __pyx_v_pw = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_v_ph);
    __pyx_v_ph = __pyx_t_1;
    __pyx_t_1 = 0;
  } else {
    __Pyx_UnpackTupleError(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size), 2);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1052
 *         pw, ph = self.physical_size
 * 
 *         glViewport(0, 0, pw, ph)             # <<<<<<<<<<<<<<
 * 
 *         glMatrixMode(GL_PROJECTION)
 */
  __pyx_t_9 = __Pyx_PyInt_from_py_GLsizei(__pyx_v_pw); if (unlikely((__pyx_t_9 == (GLsizei)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_10 = __Pyx_PyInt_from_py_GLsizei(__pyx_v_ph); if (unlikely((__pyx_t_10 == (GLsizei)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  glViewport(0, 0, __pyx_t_9, __pyx_t_10);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1054
 *         glViewport(0, 0, pw, ph)
 * 
 *         glMatrixMode(GL_PROJECTION)             # <<<<<<<<<<<<<<
 *         glLoadIdentity()
 *         glOrtho(0, pw, ph, 0, -1.0, 1.0)
 */
  glMatrixMode(GL_PROJECTION);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1055
 * 
 *         glMatrixMode(GL_PROJECTION)
 *         glLoadIdentity()             # <<<<<<<<<<<<<<
 *         glOrtho(0, pw, ph, 0, -1.0, 1.0)
 *         glMatrixMode(GL_MODELVIEW)
 */
  glLoadIdentity();

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1056
 *         glMatrixMode(GL_PROJECTION)
 *         glLoadIdentity()
 *         glOrtho(0, pw, ph, 0, -1.0, 1.0)             # <<<<<<<<<<<<<<
 *         glMatrixMode(GL_MODELVIEW)
 * 
 */
  __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_pw); if (unlikely((__pyx_t_11 == (GLdouble)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_ph); if (unlikely((__pyx_t_12 == (GLdouble)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  glOrtho(0.0, __pyx_t_11, __pyx_t_12, 0.0, (-1.0), 1.0);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1057
 *         glLoadIdentity()
 *         glOrtho(0, pw, ph, 0, -1.0, 1.0)
 *         glMatrixMode(GL_MODELVIEW)             # <<<<<<<<<<<<<<
 * 
 *         self.clip_mode_screen()
 */
  glMatrixMode(GL_MODELVIEW);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1059
 *         glMatrixMode(GL_MODELVIEW)
 * 
 *         self.clip_mode_screen()             # <<<<<<<<<<<<<<
 *         self.set_clip((0, 0, pw, ph))
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__clip_mode_screen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1060
 * 
 *         self.clip_mode_screen()
 *         self.set_clip((0, 0, pw, ph))             # <<<<<<<<<<<<<<
 * 
 *         gltexture.blit(
 */
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __Pyx_INCREF(__pyx_int_0);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_int_0);
  __Pyx_GIVEREF(__pyx_int_0);
  __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);
  if (!(likely(PyTuple_CheckExact(__pyx_t_5))||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->__pyx_vtab)->set_clip(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self), ((PyObject *)__pyx_t_5), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1063
 * 
 *         gltexture.blit(
 *             tex,             # <<<<<<<<<<<<<<
 *             x,
 *             y,
 */
  if (!(likely(((__pyx_v_tex) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_tex, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1064
 *         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 = 1064; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

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

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1066
 *             x,
 *             y,
 *             IDENTITY,             # <<<<<<<<<<<<<<
 *             1.0,
 *             self.environ,
 */
  if (!(likely(((__pyx_v_5renpy_7display_6gldraw_IDENTITY) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_5renpy_7display_6gldraw_IDENTITY, __pyx_ptype_5renpy_7display_6render_Matrix2D))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1069
 *             1.0,
 *             self.environ,
 *             False)             # <<<<<<<<<<<<<<
 * 
 *     def screenshot(self):
 */
  __pyx_t_1 = __pyx_f_5renpy_7display_9gltexture_blit(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_tex), __pyx_t_13, __pyx_t_14, ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_5renpy_7display_6gldraw_IDENTITY), 1.0, ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->environ, 0, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.draw_mouse");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_hardware);
  __Pyx_DECREF(__pyx_v_mx);
  __Pyx_DECREF(__pyx_v_my);
  __Pyx_DECREF(__pyx_v_tex);
  __Pyx_DECREF(__pyx_v_x);
  __Pyx_DECREF(__pyx_v_y);
  __Pyx_DECREF(__pyx_v_pw);
  __Pyx_DECREF(__pyx_v_ph);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1071
 *             False)
 * 
 *     def screenshot(self):             # <<<<<<<<<<<<<<
 *         cdef unsigned char *pixels = NULL
 *         cdef SDL_Surface *surf
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_screenshot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_screenshot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  unsigned char *__pyx_v_pixels;
  struct SDL_Surface *__pyx_v_surf;
  PyObject *__pyx_v_full;
  PyObject *__pyx_v_rv;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("screenshot");
  __pyx_v_full = Py_None; __Pyx_INCREF(Py_None);
  __pyx_v_rv = Py_None; __Pyx_INCREF(Py_None);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1072
 * 
 *     def screenshot(self):
 *         cdef unsigned char *pixels = NULL             # <<<<<<<<<<<<<<
 *         cdef SDL_Surface *surf
 * 
 */
  __pyx_v_pixels = NULL;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1076
 * 
 *         # A surface the size of the framebuffer
 *         full = renpy.display.pgrender.surface_unscaled(self.physical_size, False)             # <<<<<<<<<<<<<<
 * 
 *         # Use GL to read the full framebuffer in.
 */
  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __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 = 1076; __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 = 1076; __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 = 1076; __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 = 1076; __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 = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_7display_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, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __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_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_full);
  __pyx_v_full = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1079
 * 
 *         # Use GL to read the full framebuffer in.
 *         surf = PySurface_AsSurface(full)             # <<<<<<<<<<<<<<
 *         pixels = <unsigned char *> surf.pixels
 * 
 */
  __pyx_v_surf = PySurface_AsSurface(__pyx_v_full);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1080
 *         # Use GL to read the full framebuffer in.
 *         surf = PySurface_AsSurface(full)
 *         pixels = <unsigned char *> surf.pixels             # <<<<<<<<<<<<<<
 * 
 *         if GL_PACK_ROW_LENGTH != 0:
 */
  __pyx_v_pixels = ((unsigned char *)__pyx_v_surf->pixels);

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1082
 *         pixels = <unsigned char *> surf.pixels
 * 
 *         if GL_PACK_ROW_LENGTH != 0:             # <<<<<<<<<<<<<<
 * 
 *             glPixelStorei(GL_PACK_ROW_LENGTH, surf.pitch / 4)
 */
  __pyx_t_4 = (GL_PACK_ROW_LENGTH != 0);
  if (__pyx_t_4) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1084
 *         if GL_PACK_ROW_LENGTH != 0:
 * 
 *             glPixelStorei(GL_PACK_ROW_LENGTH, surf.pitch / 4)             # <<<<<<<<<<<<<<
 * 
 *             glReadPixels(
 */
    glPixelStorei(GL_PACK_ROW_LENGTH, __Pyx_div_long(__pyx_v_surf->pitch, 4));

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1093
 *                 GL_RGBA,
 *                 GL_UNSIGNED_BYTE,
 *                 pixels)             # <<<<<<<<<<<<<<
 * 
 *         # Crop and flip it, since it's upside down.
 */
    glReadPixels(0, 0, __pyx_v_surf->w, __pyx_v_surf->h, GL_RGBA, GL_UNSIGNED_BYTE, __pyx_v_pixels);
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1096
 * 
 *         # 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_1 = PyObject_GetAttr(__pyx_v_full, __pyx_n_s__subsurface); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  __Pyx_GIVEREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_box));
  __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_rv);
  __pyx_v_rv = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1097
 *         # 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_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __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__pgrender); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __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__flip_unscaled); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __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_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_v_rv);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_rv);
  __Pyx_GIVEREF(__pyx_v_rv);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_2 = 0;
  __pyx_t_1 = 0;
  __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1097; __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_v_rv);
  __pyx_v_rv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1099
 *         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.display.gldraw.GLDraw.screenshot");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_DECREF(__pyx_v_full);
  __Pyx_DECREF(__pyx_v_rv);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1101
 *         return rv
 * 
 *     def free_memory(self):             # <<<<<<<<<<<<<<
 *         self.texture_cache.clear()
 *         gltexture.dealloc_textures()
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_free_memory(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_free_memory(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("free_memory");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1102
 * 
 *     def free_memory(self):
 *         self.texture_cache.clear()             # <<<<<<<<<<<<<<
 *         gltexture.dealloc_textures()
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->texture_cache, __pyx_n_s__clear); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1103
 *     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 = 1103; __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 = 1103; __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 = 1103; __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.display.gldraw.GLDraw.free_memory");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1105
 *         gltexture.dealloc_textures()
 * 
 *     def event_peek_sleep(self):             # <<<<<<<<<<<<<<
 *         pass
 * 
 */

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

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gl.pxd":1363
 * import renpy
 * 
 * cdef inline gl_check(where):             # <<<<<<<<<<<<<<
 *     cdef GLenum error
 *     error = glGetError()
 */

static CYTHON_INLINE PyObject *__pyx_f_5renpy_7display_2gl_gl_check(PyObject *__pyx_v_where) {
  GLenum __pyx_v_error;
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannySetupContext("gl_check");

  /* "/home/tom/ab/renpy-mainline/renpy/display/gl.pxd":1365
 * cdef inline gl_check(where):
 *     cdef GLenum error
 *     error = glGetError()             # <<<<<<<<<<<<<<
 *     if error:
 *         renpy.log.info("GL error 0x%X at %s", error, where)
 */
  __pyx_v_error = glGetError();

  /* "/home/tom/ab/renpy-mainline/renpy/display/gl.pxd":1366
 *     cdef GLenum error
 *     error = glGetError()
 *     if error:             # <<<<<<<<<<<<<<
 *         renpy.log.info("GL error 0x%X at %s", error, where)
 * 
 */
  if (__pyx_v_error) {

    /* "/home/tom/ab/renpy-mainline/renpy/display/gl.pxd":1367
 *     error = glGetError()
 *     if error:
 *         renpy.log.info("GL error 0x%X at %s", error, where)             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1367; __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[1]; __pyx_lineno = 1367; __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[1]; __pyx_lineno = 1367; __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[1]; __pyx_lineno = 1367; __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[1]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(((PyObject *)__pyx_kp_s_44));
    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_44));
    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_44));
    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, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_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.display.gl.gl_check");
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pxd":10
 *     cdef object window
 *     cdef tuple virtual_size
 *     cdef public tuple physical_size             # <<<<<<<<<<<<<<
 *     cdef tuple virtual_box
 *     cdef tuple physical_box
 */

static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_13physical_size___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_13physical_size___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_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_7display_6gldraw_6GLDraw_13physical_size___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6gldraw_6GLDraw_13physical_size___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __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[2]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->physical_size = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.physical_size.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pxd":18
 *     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_7display_6gldraw_6GLDraw_4info___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_4info___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_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_7display_6gldraw_6GLDraw_4info___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6gldraw_6GLDraw_4info___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __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[2]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info));
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->info = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gldraw.GLDraw.info.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pxd":20
 *     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_7display_6gldraw_6GLDraw_18fullscreen_surface___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6gldraw_6GLDraw_18fullscreen_surface___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  __pyx_r = ((struct __pyx_obj_5renpy_7display_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_7display_6gldraw_6GLDraw_18fullscreen_surface___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6gldraw_6GLDraw_18fullscreen_surface___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  __Pyx_DECREF(((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface);
  ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)__pyx_v_self)->fullscreen_surface = __pyx_v_value;

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

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

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdx = __pyx_t_1;

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3xdy___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->xdy = __pyx_t_1;

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

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":4
 *     cdef public double xdx
 *     cdef public double xdy
 *     cdef public double ydx             # <<<<<<<<<<<<<<
 *     cdef public double ydy
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydx___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydx = __pyx_t_1;

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

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

static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_8Matrix2D_3ydy___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Matrix2D *)__pyx_v_self)->ydy = __pyx_t_1;

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

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":11
 * cdef class Render:
 * 
 *     cdef public bint mark, cache_killed             # <<<<<<<<<<<<<<
 * 
 *     cdef public int width, height
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4mark___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_4mark___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->mark); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.mark.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_4mark___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_4mark___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->mark = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.mark.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_12cache_killed___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->cache_killed); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.cache_killed.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_12cache_killed___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_12cache_killed___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->cache_killed = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.cache_killed.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":13
 *     cdef public bint mark, cache_killed
 * 
 *     cdef public int width, height             # <<<<<<<<<<<<<<
 *     cdef public object layer_name
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5width___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5width___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.width.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_5width___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_5width___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->width = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.width.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6height___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6height___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.height.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_6height___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_6height___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->height = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.height.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":14
 * 
 *     cdef public int width, height
 *     cdef public object layer_name             # <<<<<<<<<<<<<<
 * 
 *     cdef public list children
 */

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

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

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

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

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

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

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

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

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

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

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

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

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

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":17
 * 
 *     cdef public list children
 *     cdef public set parents             # <<<<<<<<<<<<<<
 *     cdef public list depends_on_list
 * 
 */

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

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

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

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

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

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

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

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

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

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

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.depends_on_list.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9operation___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_9operation___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.operation.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_9operation___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_9operation___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.operation.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":21
 * 
 *     cdef public int operation
 *     cdef public double operation_complete             # <<<<<<<<<<<<<<
 *     cdef public bint operation_alpha
 *     cdef public object operation_parameter
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_18operation_complete___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_complete); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.operation_complete.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_18operation_complete___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_18operation_complete___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_complete = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.operation_complete.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":22
 *     cdef public int operation
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha             # <<<<<<<<<<<<<<
 *     cdef public object operation_parameter
 * 
 */

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.operation_alpha.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_15operation_alpha___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->operation_alpha = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.operation_alpha.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":23
 *     cdef public double operation_complete
 *     cdef public bint operation_alpha
 *     cdef public object operation_parameter             # <<<<<<<<<<<<<<
 * 
 *     cdef public Matrix2D forward, reverse
 */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5alpha___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.alpha.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_5alpha___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_5alpha___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  double __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->alpha = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.alpha.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":28
 *     cdef public double alpha
 * 
 *     cdef public list focuses             # <<<<<<<<<<<<<<
 *     cdef public list pass_focuses
 *     cdef public object draw_func
 */

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

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

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

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

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

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

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

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

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

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

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.pass_focuses.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_6opaque___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.opaque.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_6opaque___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_6opaque___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->opaque = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.opaque.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/render.pxd":34
 * 
 *     cdef public bint opaque
 *     cdef public list visible_children             # <<<<<<<<<<<<<<
 * 
 *     cdef public bint clipping
 */

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

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

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

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.render.Render.visible_children.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8clipping___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_8clipping___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->clipping); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.clipping.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_8clipping___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_8clipping___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->clipping = __pyx_t_1;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5modal___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_6render_6Render_5modal___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->modal); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.render.Render.modal.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_6render_6Render_5modal___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_6render_6Render_5modal___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_6render_Render *)__pyx_v_self)->modal = __pyx_t_1;

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":4
 * 
 * cdef class TextureCore:
 *     cdef public int width             # <<<<<<<<<<<<<<
 *     cdef public int height
 *     cdef public int generation
 */

static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_5width___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_5width___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.width.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_5width___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_5width___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->width = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.width.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":5
 * cdef class TextureCore:
 *     cdef public int width
 *     cdef public int height             # <<<<<<<<<<<<<<
 *     cdef public int generation
 *     cdef public unsigned int number
 */

static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_6height___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_6height___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.height.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_6height___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_6height___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->height = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.height.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":6
 *     cdef public int width
 *     cdef public int height
 *     cdef public int generation             # <<<<<<<<<<<<<<
 *     cdef public unsigned int number
 *     cdef int format
 */

static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_10generation___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_10generation___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->generation); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.generation.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_10generation___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_10generation___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->generation = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.generation.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":7
 *     cdef public int height
 *     cdef public int generation
 *     cdef public unsigned int number             # <<<<<<<<<<<<<<
 *     cdef int format
 *     cdef double xmul
 */

static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_6number___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_6number___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromUnsignedLong(((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->number); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.number.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_6number___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_6number___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  unsigned int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsUnsignedInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->number = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.number.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":20
 *     cdef int premult_bottom
 *     cdef bint nearest
 *     cdef public list free_list             # <<<<<<<<<<<<<<
 * 
 *     cdef void make_ready(TextureCore)
 */

static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_9free_list___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureCore_9free_list___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list));
  __pyx_r = ((PyObject *)((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list);
  goto __pyx_L0;

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

static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_9free_list___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_9free_list___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(PyList_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_v_value)->tp_name), 0))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list));
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list = ((PyObject *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureCore.free_list.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_9free_list___del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureCore_9free_list___del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list));
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureCore *)__pyx_v_self)->free_list = ((PyObject *)Py_None);

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

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":29
 * cdef class TextureGrid:
 * 
 *    cdef public int width             # <<<<<<<<<<<<<<
 *    cdef public int height
 *    cdef list rows
 */

static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureGrid_5width___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureGrid_5width___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_self)->width); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gltexture.TextureGrid.width.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_9gltexture_11TextureGrid_5width___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureGrid_5width___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_self)->width = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureGrid.width.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":30
 * 
 *    cdef public int width
 *    cdef public int height             # <<<<<<<<<<<<<<
 *    cdef list rows
 *    cdef list columns
 */

static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureGrid_6height___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_5renpy_7display_9gltexture_11TextureGrid_6height___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_self)->height); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("renpy.display.gltexture.TextureGrid.height.__get__");
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_5renpy_7display_9gltexture_11TextureGrid_6height___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureGrid_6height___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("__set__");
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_self)->height = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureGrid.height.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":34
 *    cdef list columns
 *    cdef list tiles # list of lists.
 *    cdef public TextureGrid half_cache             # <<<<<<<<<<<<<<
 * 
 *    cdef void make_ready(self, bint nearest)
 */

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

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

static int __pyx_pf_5renpy_7display_9gltexture_11TextureGrid_10half_cache___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_5renpy_7display_9gltexture_11TextureGrid_10half_cache___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_5renpy_7display_9gltexture_TextureGrid))))) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_self)->half_cache);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_self)->half_cache));
  ((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_self)->half_cache = ((struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("renpy.display.gltexture.TextureGrid.half_cache.__set__");
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_5renpy_7display_6gldraw_GLDraw __pyx_vtable_5renpy_7display_6gldraw_GLDraw;

static PyObject *__pyx_tp_new_5renpy_7display_6gldraw_GLDraw(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)o);
  p->__pyx_vtab = __pyx_vtabptr_5renpy_7display_6gldraw_GLDraw;
  p->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->clip_rtt_box = ((PyObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6gldraw_GLDraw(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)o;
  Py_XDECREF(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->clip_rtt_box));
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_7display_6gldraw_GLDraw(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)o;
  if (p->environ) {
    e = (*v)(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->clip_rtt_box) {
    e = (*v)(p->clip_rtt_box, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_7display_6gldraw_GLDraw(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *p = (struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->environ);
  p->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->clip_rtt_box);
  p->clip_rtt_box = ((PyObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5renpy_7display_6gldraw_6GLDraw_physical_size(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_13physical_size___get__(o);
}

static int __pyx_setprop_5renpy_7display_6gldraw_6GLDraw_physical_size(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_13physical_size___set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_13physical_size___del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6gldraw_6GLDraw_info(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_4info___get__(o);
}

static int __pyx_setprop_5renpy_7display_6gldraw_6GLDraw_info(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_4info___set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_4info___del__(o);
  }
}

static PyObject *__pyx_getprop_5renpy_7display_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, void *x) {
  return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_18fullscreen_surface___get__(o);
}

static int __pyx_setprop_5renpy_7display_6gldraw_6GLDraw_fullscreen_surface(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_18fullscreen_surface___set__(o, v);
  }
  else {
    return __pyx_pf_5renpy_7display_6gldraw_6GLDraw_18fullscreen_surface___del__(o);
  }
}

static PyMethodDef __pyx_methods_5renpy_7display_6gldraw_GLDraw[] = {
  {__Pyx_NAMESTR("set_mode"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_set_mode, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_set_mode)},
  {__Pyx_NAMESTR("deinit"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_deinit, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_deinit)},
  {__Pyx_NAMESTR("quit"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_quit, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_init, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_init)},
  {__Pyx_NAMESTR("should_redraw"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_should_redraw, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_should_redraw)},
  {__Pyx_NAMESTR("mutated_surface"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_mutated_surface, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("load_texture"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_load_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("clip_mode_screen"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_clip_mode_screen, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_clip_mode_screen)},
  {__Pyx_NAMESTR("clip_mode_rtt"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_clip_mode_rtt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_clip_mode_rtt)},
  {__Pyx_NAMESTR("set_clip"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_set_clip, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("draw_screen"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_screen, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_draw_screen)},
  {__Pyx_NAMESTR("draw_render_textures"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_render_textures, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_draw_render_textures)},
  {__Pyx_NAMESTR("draw_transformed"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_transformed, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("render_to_texture"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_render_to_texture, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("is_pixel_opaque"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_is_pixel_opaque, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_is_pixel_opaque)},
  {__Pyx_NAMESTR("get_half"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_get_half, METH_O, __Pyx_DOCSTR(__pyx_doc_5renpy_7display_6gldraw_6GLDraw_get_half)},
  {__Pyx_NAMESTR("update_mouse"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_update_mouse, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("translate_mouse"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_translate_mouse, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("mouse_event"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_mouse_event, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("get_mouse_pos"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_get_mouse_pos, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("draw_mouse"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_draw_mouse, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("screenshot"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_screenshot, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("free_memory"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_free_memory, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("event_peek_sleep"), (PyCFunction)__pyx_pf_5renpy_7display_6gldraw_6GLDraw_event_peek_sleep, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5renpy_7display_6gldraw_GLDraw[] = {
  {(char *)"physical_size", __pyx_getprop_5renpy_7display_6gldraw_6GLDraw_physical_size, __pyx_setprop_5renpy_7display_6gldraw_6GLDraw_physical_size, 0, 0},
  {(char *)"info", __pyx_getprop_5renpy_7display_6gldraw_6GLDraw_info, __pyx_setprop_5renpy_7display_6gldraw_6GLDraw_info, 0, 0},
  {(char *)"fullscreen_surface", __pyx_getprop_5renpy_7display_6gldraw_6GLDraw_fullscreen_surface, __pyx_setprop_5renpy_7display_6gldraw_6GLDraw_fullscreen_surface, 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
};

PyTypeObject __pyx_type_5renpy_7display_6gldraw_GLDraw = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.display.gldraw.GLDraw"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_7display_6gldraw_GLDraw, /*tp_traverse*/
  __pyx_tp_clear_5renpy_7display_6gldraw_GLDraw, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_7display_6gldraw_GLDraw, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5renpy_7display_6gldraw_GLDraw, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pf_5renpy_7display_6gldraw_6GLDraw___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5renpy_7display_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_7display_6gldraw___pyx_scope_struct_init(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *)o);
  p->__pyx_v_e = 0;
  p->__pyx_v_err = 0;
  p->__pyx_v_extensions = 0;
  p->__pyx_v_extensions_string = 0;
  p->__pyx_v_i = 0;
  p->__pyx_v_r = 0;
  p->__pyx_v_renderer = 0;
  p->__pyx_v_self = 0;
  p->__pyx_v_use_subsystem = 0;
  p->__pyx_v_v = 0;
  p->__pyx_v_version = 0;
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6gldraw___pyx_scope_struct_init(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *)o;
  Py_XDECREF(p->__pyx_v_e);
  Py_XDECREF(p->__pyx_v_err);
  Py_XDECREF(p->__pyx_v_extensions);
  Py_XDECREF(p->__pyx_v_extensions_string);
  Py_XDECREF(p->__pyx_v_i);
  Py_XDECREF(p->__pyx_v_r);
  Py_XDECREF(p->__pyx_v_renderer);
  Py_XDECREF(((PyObject *)p->__pyx_v_self));
  Py_XDECREF(p->__pyx_v_use_subsystem);
  Py_XDECREF(p->__pyx_v_v);
  Py_XDECREF(p->__pyx_v_version);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_7display_6gldraw___pyx_scope_struct_init(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *)o;
  if (p->__pyx_v_e) {
    e = (*v)(p->__pyx_v_e, a); if (e) return e;
  }
  if (p->__pyx_v_err) {
    e = (*v)(p->__pyx_v_err, a); if (e) return e;
  }
  if (p->__pyx_v_extensions) {
    e = (*v)(p->__pyx_v_extensions, a); if (e) return e;
  }
  if (p->__pyx_v_extensions_string) {
    e = (*v)(p->__pyx_v_extensions_string, a); if (e) return e;
  }
  if (p->__pyx_v_i) {
    e = (*v)(p->__pyx_v_i, a); if (e) return e;
  }
  if (p->__pyx_v_r) {
    e = (*v)(p->__pyx_v_r, a); if (e) return e;
  }
  if (p->__pyx_v_renderer) {
    e = (*v)(p->__pyx_v_renderer, 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_use_subsystem) {
    e = (*v)(p->__pyx_v_use_subsystem, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, a); if (e) return e;
  }
  if (p->__pyx_v_version) {
    e = (*v)(p->__pyx_v_version, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_7display_6gldraw___pyx_scope_struct_init(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_e);
  p->__pyx_v_e = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_err);
  p->__pyx_v_err = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_extensions);
  p->__pyx_v_extensions = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_extensions_string);
  p->__pyx_v_extensions_string = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_i);
  p->__pyx_v_i = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_r);
  p->__pyx_v_r = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_renderer);
  p->__pyx_v_renderer = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_use_subsystem);
  p->__pyx_v_use_subsystem = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_v);
  p->__pyx_v_v = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_version);
  p->__pyx_v_version = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5renpy_7display_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
};

PyTypeObject __pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_init = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.display.gldraw.__pyx_scope_struct_init"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_init), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_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_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_7display_6gldraw___pyx_scope_struct_init, /*tp_traverse*/
  __pyx_tp_clear_5renpy_7display_6gldraw___pyx_scope_struct_init, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_7display_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_7display_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_7display_6gldraw___pyx_scope_struct_render_to_texture(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *)o);
  p->__pyx_v_alpha = 0;
  p->__pyx_v_draw_func = 0;
  p->__pyx_v_forward = 0;
  p->__pyx_v_reverse = 0;
  p->__pyx_v_rv = 0;
  p->__pyx_v_self = 0;
  p->__pyx_v_self_ = 0;
  p->__pyx_v_what = 0;
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *)o;
  Py_XDECREF(p->__pyx_v_alpha);
  Py_XDECREF(p->__pyx_v_draw_func);
  Py_XDECREF(p->__pyx_v_forward);
  Py_XDECREF(p->__pyx_v_reverse);
  Py_XDECREF(p->__pyx_v_rv);
  Py_XDECREF(((PyObject *)p->__pyx_v_self));
  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_7display_6gldraw___pyx_scope_struct_render_to_texture(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *)o;
  if (p->__pyx_v_alpha) {
    e = (*v)(p->__pyx_v_alpha, a); if (e) return e;
  }
  if (p->__pyx_v_draw_func) {
    e = (*v)(p->__pyx_v_draw_func, a); if (e) return e;
  }
  if (p->__pyx_v_forward) {
    e = (*v)(p->__pyx_v_forward, 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_rv) {
    e = (*v)(p->__pyx_v_rv, 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_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_7display_6gldraw___pyx_scope_struct_render_to_texture(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_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_draw_func);
  p->__pyx_v_draw_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_forward);
  p->__pyx_v_forward = 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_rv);
  p->__pyx_v_rv = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self_);
  p->__pyx_v_self_ = ((struct __pyx_obj_5renpy_7display_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_7display_6gldraw___pyx_scope_struct_render_to_texture[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_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_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_render_to_texture = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_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
};

PyTypeObject __pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.display.gldraw.__pyx_scope_struct_render_to_texture"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_6gldraw___pyx_scope_struct_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_render_to_texture, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_render_to_texture, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_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_render_to_texture, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture, /*tp_traverse*/
  __pyx_tp_clear_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_7display_6gldraw___pyx_scope_struct_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_7display_6gldraw___pyx_scope_struct_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_7display_6gldraw___pyx_scope_struct_get_half(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *)o);
  p->__pyx_v_draw = 0;
  p->__pyx_v_draw_func = 0;
  p->__pyx_v_forward = 0;
  p->__pyx_v_height = 0;
  p->__pyx_v_reverse = 0;
  p->__pyx_v_rv = 0;
  p->__pyx_v_self = 0;
  p->__pyx_v_what = 0;
  p->__pyx_v_width = 0;
  return o;
}

static void __pyx_tp_dealloc_5renpy_7display_6gldraw___pyx_scope_struct_get_half(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *)o;
  Py_XDECREF(((PyObject *)p->__pyx_v_draw));
  Py_XDECREF(p->__pyx_v_draw_func);
  Py_XDECREF(p->__pyx_v_forward);
  Py_XDECREF(p->__pyx_v_height);
  Py_XDECREF(p->__pyx_v_reverse);
  Py_XDECREF(p->__pyx_v_rv);
  Py_XDECREF(((PyObject *)p->__pyx_v_self));
  Py_XDECREF(p->__pyx_v_what);
  Py_XDECREF(p->__pyx_v_width);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_5renpy_7display_6gldraw___pyx_scope_struct_get_half(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *)o;
  if (p->__pyx_v_draw) {
    e = (*v)(((PyObject*)p->__pyx_v_draw), a); if (e) return e;
  }
  if (p->__pyx_v_draw_func) {
    e = (*v)(p->__pyx_v_draw_func, a); if (e) return e;
  }
  if (p->__pyx_v_forward) {
    e = (*v)(p->__pyx_v_forward, 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_rv) {
    e = (*v)(p->__pyx_v_rv, 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;
  }
  if (p->__pyx_v_width) {
    e = (*v)(p->__pyx_v_width, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5renpy_7display_6gldraw___pyx_scope_struct_get_half(PyObject *o) {
  struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *p = (struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half *)o;
  PyObject* tmp;
  tmp = ((PyObject*)p->__pyx_v_draw);
  p->__pyx_v_draw = ((struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_draw_func);
  p->__pyx_v_draw_func = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_forward);
  p->__pyx_v_forward = 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_rv);
  p->__pyx_v_rv = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5renpy_7display_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);
  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_7display_6gldraw___pyx_scope_struct_get_half[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_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_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_get_half = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_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
};

PyTypeObject __pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_get_half = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("renpy.display.gldraw.__pyx_scope_struct_get_half"), /*tp_name*/
  sizeof(struct __pyx_obj_5renpy_7display_6gldraw___pyx_scope_struct_get_half), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5renpy_7display_6gldraw___pyx_scope_struct_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_get_half, /*tp_as_number*/
  &__pyx_tp_as_sequence___pyx_scope_struct_get_half, /*tp_as_sequence*/
  &__pyx_tp_as_mapping___pyx_scope_struct_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_get_half, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5renpy_7display_6gldraw___pyx_scope_struct_get_half, /*tp_traverse*/
  __pyx_tp_clear_5renpy_7display_6gldraw___pyx_scope_struct_get_half, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5renpy_7display_6gldraw___pyx_scope_struct_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_7display_6gldraw___pyx_scope_struct_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_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
  {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0},
  {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
  {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0},
  {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
  {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1},
  {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1},
  {&__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_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1},
  {&__pyx_n_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 1},
  {&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_n_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 1},
  {&__pyx_n_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 1},
  {&__pyx_kp_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 0},
  {&__pyx_n_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 1},
  {&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
  {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0},
  {&__pyx_n_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 1},
  {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
  {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_n_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 1},
  {&__pyx_n_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 1},
  {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0},
  {&__pyx_n_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 1},
  {&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
  {&__pyx_n_s_45, __pyx_k_45, sizeof(__pyx_k_45), 0, 0, 1, 1},
  {&__pyx_n_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 1},
  {&__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_n_s_49, __pyx_k_49, sizeof(__pyx_k_49), 0, 0, 1, 1},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_n_s_50, __pyx_k_50, sizeof(__pyx_k_50), 0, 0, 1, 1},
  {&__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_n_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 1},
  {&__pyx_kp_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 0},
  {&__pyx_kp_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 0},
  {&__pyx_kp_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 0},
  {&__pyx_kp_u_57, __pyx_k_57, sizeof(__pyx_k_57), 0, 1, 0, 0},
  {&__pyx_kp_u_58, __pyx_k_58, sizeof(__pyx_k_58), 0, 1, 0, 0},
  {&__pyx_kp_u_59, __pyx_k_59, sizeof(__pyx_k_59), 0, 1, 0, 0},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_u_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 1, 0, 0},
  {&__pyx_kp_u_61, __pyx_k_61, sizeof(__pyx_k_61), 0, 1, 0, 0},
  {&__pyx_kp_u_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 1, 0, 0},
  {&__pyx_kp_u_63, __pyx_k_63, sizeof(__pyx_k_63), 0, 1, 0, 0},
  {&__pyx_kp_u_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 1, 0, 0},
  {&__pyx_kp_u_65, __pyx_k_65, sizeof(__pyx_k_65), 0, 1, 0, 0},
  {&__pyx_kp_u_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 1, 0, 0},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 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__GLDraw, __pyx_k__GLDraw, sizeof(__pyx_k__GLDraw), 0, 0, 1, 1},
  {&__pyx_n_s__GLError, __pyx_k__GLError, sizeof(__pyx_k__GLError), 0, 0, 1, 1},
  {&__pyx_n_s__GL_ALPHA_SIZE, __pyx_k__GL_ALPHA_SIZE, sizeof(__pyx_k__GL_ALPHA_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s__GL_SWAP_CONTROL, __pyx_k__GL_SWAP_CONTROL, sizeof(__pyx_k__GL_SWAP_CONTROL), 0, 0, 1, 1},
  {&__pyx_n_s__IDENTITY, __pyx_k__IDENTITY, sizeof(__pyx_k__IDENTITY), 0, 0, 1, 1},
  {&__pyx_n_s__IMAGEDISSOLVE, __pyx_k__IMAGEDISSOLVE, sizeof(__pyx_k__IMAGEDISSOLVE), 0, 0, 1, 1},
  {&__pyx_n_s__ImportError, __pyx_k__ImportError, sizeof(__pyx_k__ImportError), 0, 0, 1, 1},
  {&__pyx_n_s__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__OPENGL, __pyx_k__OPENGL, sizeof(__pyx_k__OPENGL), 0, 0, 1, 1},
  {&__pyx_n_s__PIXELLATE, __pyx_k__PIXELLATE, sizeof(__pyx_k__PIXELLATE), 0, 0, 1, 1},
  {&__pyx_n_s__RENPY_GL_ENVIRON, __pyx_k__RENPY_GL_ENVIRON, sizeof(__pyx_k__RENPY_GL_ENVIRON), 0, 0, 1, 1},
  {&__pyx_n_s__RENPY_GL_RTT, __pyx_k__RENPY_GL_RTT, sizeof(__pyx_k__RENPY_GL_RTT), 0, 0, 1, 1},
  {&__pyx_n_s__RENPY_GL_VSYNC, __pyx_k__RENPY_GL_VSYNC, sizeof(__pyx_k__RENPY_GL_VSYNC), 0, 0, 1, 1},
  {&__pyx_n_s__RESIZABLE, __pyx_k__RESIZABLE, sizeof(__pyx_k__RESIZABLE), 0, 0, 1, 1},
  {&__pyx_n_s__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__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1},
  {&__pyx_n_s__alpha_surface, __pyx_k__alpha_surface, sizeof(__pyx_k__alpha_surface), 0, 0, 1, 1},
  {&__pyx_n_s__always_opaque, __pyx_k__always_opaque, sizeof(__pyx_k__always_opaque), 0, 0, 1, 1},
  {&__pyx_n_s__android, __pyx_k__android, sizeof(__pyx_k__android), 0, 0, 1, 1},
  {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1},
  {&__pyx_n_s__audio, __pyx_k__audio, sizeof(__pyx_k__audio), 0, 0, 1, 1},
  {&__pyx_n_s__cache_killed, __pyx_k__cache_killed, sizeof(__pyx_k__cache_killed), 0, 0, 1, 1},
  {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 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_cache, __pyx_k__clip_cache, sizeof(__pyx_k__clip_cache), 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__clip_rtt_box, __pyx_k__clip_rtt_box, sizeof(__pyx_k__clip_rtt_box), 0, 0, 1, 1},
  {&__pyx_n_s__clipping, __pyx_k__clipping, sizeof(__pyx_k__clipping), 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__core, __pyx_k__core, sizeof(__pyx_k__core), 0, 0, 1, 1},
  {&__pyx_n_s__cpu_idle, __pyx_k__cpu_idle, sizeof(__pyx_k__cpu_idle), 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__depends_on_list, __pyx_k__depends_on_list, sizeof(__pyx_k__depends_on_list), 0, 0, 1, 1},
  {&__pyx_n_s__did_init, __pyx_k__did_init, sizeof(__pyx_k__did_init), 0, 0, 1, 1},
  {&__pyx_n_s__display, __pyx_k__display, sizeof(__pyx_k__display), 0, 0, 1, 1},
  {&__pyx_n_s__display_info, __pyx_k__display_info, sizeof(__pyx_k__display_info), 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__fast_dissolve, __pyx_k__fast_dissolve, sizeof(__pyx_k__fast_dissolve), 0, 0, 1, 1},
  {&__pyx_n_s__fbo, __pyx_k__fbo, sizeof(__pyx_k__fbo), 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__focuses, __pyx_k__focuses, sizeof(__pyx_k__focuses), 0, 0, 1, 1},
  {&__pyx_n_s__forward, __pyx_k__forward, sizeof(__pyx_k__forward), 0, 0, 1, 1},
  {&__pyx_n_s__free_list, __pyx_k__free_list, sizeof(__pyx_k__free_list), 0, 0, 1, 1},
  {&__pyx_n_s__free_memory, __pyx_k__free_memory, sizeof(__pyx_k__free_memory), 0, 0, 1, 1},
  {&__pyx_n_s__fullscreen, __pyx_k__fullscreen, sizeof(__pyx_k__fullscreen), 0, 0, 1, 1},
  {&__pyx_n_s__fullscreen_surface, __pyx_k__fullscreen_surface, sizeof(__pyx_k__fullscreen_surface), 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__generation, __pyx_k__generation, sizeof(__pyx_k__generation), 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_movie_texture, __pyx_k__get_movie_texture, sizeof(__pyx_k__get_movie_texture), 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__getattr, __pyx_k__getattr, sizeof(__pyx_k__getattr), 0, 0, 1, 1},
  {&__pyx_n_s__gl, __pyx_k__gl, sizeof(__pyx_k__gl), 0, 0, 1, 1},
  {&__pyx_n_s__gl_enable, __pyx_k__gl_enable, sizeof(__pyx_k__gl_enable), 0, 0, 1, 1},
  {&__pyx_n_s__gl_set_attribute, __pyx_k__gl_set_attribute, sizeof(__pyx_k__gl_set_attribute), 0, 0, 1, 1},
  {&__pyx_n_s__gl_size, __pyx_k__gl_size, sizeof(__pyx_k__gl_size), 0, 0, 1, 1},
  {&__pyx_n_s__glenviron, __pyx_k__glenviron, sizeof(__pyx_k__glenviron), 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__info, __pyx_k__info, sizeof(__pyx_k__info), 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__is_pixel_opaque, __pyx_k__is_pixel_opaque, sizeof(__pyx_k__is_pixel_opaque), 0, 0, 1, 1},
  {&__pyx_n_s__kill, __pyx_k__kill, sizeof(__pyx_k__kill), 0, 0, 1, 1},
  {&__pyx_n_s__last_redraw_time, __pyx_k__last_redraw_time, sizeof(__pyx_k__last_redraw_time), 0, 0, 1, 1},
  {&__pyx_n_s__layer_name, __pyx_k__layer_name, sizeof(__pyx_k__layer_name), 0, 0, 1, 1},
  {&__pyx_n_s__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__mark, __pyx_k__mark, sizeof(__pyx_k__mark), 0, 0, 1, 1},
  {&__pyx_n_s__modal, __pyx_k__modal, sizeof(__pyx_k__modal), 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__mouse_info, __pyx_k__mouse_info, sizeof(__pyx_k__mouse_info), 0, 0, 1, 1},
  {&__pyx_n_s__mouse_old_visible, __pyx_k__mouse_old_visible, sizeof(__pyx_k__mouse_old_visible), 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__number, __pyx_k__number, sizeof(__pyx_k__number), 0, 0, 1, 1},
  {&__pyx_n_s__old_fullscreen, __pyx_k__old_fullscreen, sizeof(__pyx_k__old_fullscreen), 0, 0, 1, 1},
  {&__pyx_n_s__opaque, __pyx_k__opaque, sizeof(__pyx_k__opaque), 0, 0, 1, 1},
  {&__pyx_n_s__operation, __pyx_k__operation, sizeof(__pyx_k__operation), 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__operation_parameter, __pyx_k__operation_parameter, sizeof(__pyx_k__operation_parameter), 0, 0, 1, 1},
  {&__pyx_n_s__opygame, __pyx_k__opygame, sizeof(__pyx_k__opygame), 0, 0, 1, 1},
  {&__pyx_n_s__os, __pyx_k__os, sizeof(__pyx_k__os), 0, 0, 1, 1},
  {&__pyx_n_s__parents, __pyx_k__parents, sizeof(__pyx_k__parents), 0, 0, 1, 1},
  {&__pyx_n_s__pass_focuses, __pyx_k__pass_focuses, sizeof(__pyx_k__pass_focuses), 0, 0, 1, 1},
  {&__pyx_n_s__pgrender, __pyx_k__pgrender, sizeof(__pyx_k__pgrender), 0, 0, 1, 1},
  {&__pyx_n_s__physical_box, __pyx_k__physical_box, sizeof(__pyx_k__physical_box), 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__pitch, __pyx_k__pitch, sizeof(__pyx_k__pitch), 0, 0, 1, 1},
  {&__pyx_n_s__pixels, __pyx_k__pixels, sizeof(__pyx_k__pixels), 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__redraw_period, __pyx_k__redraw_period, sizeof(__pyx_k__redraw_period), 0, 0, 1, 1},
  {&__pyx_n_s__render, __pyx_k__render, sizeof(__pyx_k__render), 0, 0, 1, 1},
  {&__pyx_n_s__render_of, __pyx_k__render_of, sizeof(__pyx_k__render_of), 0, 0, 1, 1},
  {&__pyx_n_s__render_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__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__set, __pyx_k__set, sizeof(__pyx_k__set), 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__should_redraw, __pyx_k__should_redraw, sizeof(__pyx_k__should_redraw), 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__startswith, __pyx_k__startswith, sizeof(__pyx_k__startswith), 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__texture_cache, __pyx_k__texture_cache, sizeof(__pyx_k__texture_cache), 0, 0, 1, 1},
  {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1},
  {&__pyx_n_s__transform, __pyx_k__transform, sizeof(__pyx_k__transform), 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__upscale_factor, __pyx_k__upscale_factor, sizeof(__pyx_k__upscale_factor), 0, 0, 1, 1},
  {&__pyx_n_s__use_clipping_planes, __pyx_k__use_clipping_planes, sizeof(__pyx_k__use_clipping_planes), 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_box, __pyx_k__virtual_box, sizeof(__pyx_k__virtual_box), 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__visible_children, __pyx_k__visible_children, sizeof(__pyx_k__visible_children), 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__window, __pyx_k__window, sizeof(__pyx_k__window), 0, 0, 1, 1},
  {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
  {&__pyx_n_s__xdx, __pyx_k__xdx, sizeof(__pyx_k__xdx), 0, 0, 1, 1},
  {&__pyx_n_s__xdy, __pyx_k__xdy, sizeof(__pyx_k__xdy), 0, 0, 1, 1},
  {&__pyx_n_s__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__ydx, __pyx_k__ydx, sizeof(__pyx_k__ydx), 0, 0, 1, 1},
  {&__pyx_n_s__ydy, __pyx_k__ydy, sizeof(__pyx_k__ydy), 0, 0, 1, 1},
  {&__pyx_n_s__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_ImportError = __Pyx_GetName(__pyx_b, __pyx_n_s__ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetName(__pyx_b, __pyx_n_s__Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __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 = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_getattr = __Pyx_GetName(__pyx_b, __pyx_n_s__getattr); if (!__pyx_builtin_getattr) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  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_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_102 = PyInt_FromLong(102); if (unlikely(!__pyx_int_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initgldraw(void); /*proto*/
PyMODINIT_FUNC initgldraw(void)
#else
PyMODINIT_FUNC PyInit_gldraw(void); /*proto*/
PyMODINIT_FUNC PyInit_gldraw(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  #if CYTHON_REFNANNY
  void* __pyx_refnanny = NULL;
  __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");
  }
  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_gldraw(void)", __LINE__, __FILE__);
  #endif
  __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__display__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;}
  /*--- Global init code ---*/
  __pyx_v_5renpy_7display_6gldraw_IDENTITY = Py_None; Py_INCREF(Py_None);
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_vtabptr_5renpy_7display_6gldraw_GLDraw = &__pyx_vtable_5renpy_7display_6gldraw_GLDraw;
  #if PY_MAJOR_VERSION >= 3
  __pyx_vtable_5renpy_7display_6gldraw_GLDraw.set_clip = (PyObject *(*)(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *, PyObject *, int __pyx_skip_dispatch))__pyx_f_5renpy_7display_6gldraw_6GLDraw_set_clip;
  __pyx_vtable_5renpy_7display_6gldraw_GLDraw.draw_render_textures = (int (*)(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *, PyObject *, int, int __pyx_skip_dispatch))__pyx_f_5renpy_7display_6gldraw_6GLDraw_draw_render_textures;
  __pyx_vtable_5renpy_7display_6gldraw_GLDraw.draw_transformed = (int (*)(struct __pyx_obj_5renpy_7display_6gldraw_GLDraw *, PyObject *, PyObject *, double, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, int __pyx_skip_dispatch))__pyx_f_5renpy_7display_6gldraw_6GLDraw_draw_transformed;
  #else
  *(void(**)(void))&__pyx_vtable_5renpy_7display_6gldraw_GLDraw.set_clip = (void(*)(void))__pyx_f_5renpy_7display_6gldraw_6GLDraw_set_clip;
  *(void(**)(void))&__pyx_vtable_5renpy_7display_6gldraw_GLDraw.draw_render_textures = (void(*)(void))__pyx_f_5renpy_7display_6gldraw_6GLDraw_draw_render_textures;
  *(void(**)(void))&__pyx_vtable_5renpy_7display_6gldraw_GLDraw.draw_transformed = (void(*)(void))__pyx_f_5renpy_7display_6gldraw_6GLDraw_draw_transformed;
  #endif
  if (PyType_Ready(&__pyx_type_5renpy_7display_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_5renpy_7display_6gldraw_GLDraw.tp_dict, __pyx_vtabptr_5renpy_7display_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "GLDraw", (PyObject *)&__pyx_type_5renpy_7display_6gldraw_GLDraw) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_6gldraw_GLDraw = &__pyx_type_5renpy_7display_6gldraw_GLDraw;
  if (PyType_Ready(&__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_init) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "__pyx_scope_struct_init", (PyObject *)&__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_init) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_init = &__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_init;
  if (PyType_Ready(&__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "__pyx_scope_struct_render_to_texture", (PyObject *)&__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture = &__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_render_to_texture;
  if (PyType_Ready(&__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_get_half) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "__pyx_scope_struct_get_half", (PyObject *)&__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_get_half) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_6gldraw___pyx_scope_struct_get_half = &__pyx_type_5renpy_7display_6gldraw___pyx_scope_struct_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;}
  if (__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6render_Matrix2D->tp_dict, &__pyx_vtabptr_5renpy_7display_6render_Matrix2D) < 0) {__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;}
  if (__Pyx_GetVtable(__pyx_ptype_5renpy_7display_6render_Render->tp_dict, &__pyx_vtabptr_5renpy_7display_6render_Render) < 0) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_9gltexture_TextureCore = __Pyx_ImportType("renpy.display.gltexture", "TextureCore", sizeof(struct __pyx_obj_5renpy_7display_9gltexture_TextureCore), 1); if (unlikely(!__pyx_ptype_5renpy_7display_9gltexture_TextureCore)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_GetVtable(__pyx_ptype_5renpy_7display_9gltexture_TextureCore->tp_dict, &__pyx_vtabptr_5renpy_7display_9gltexture_TextureCore) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_5renpy_7display_9gltexture_TextureGrid = __Pyx_ImportType("renpy.display.gltexture", "TextureGrid", sizeof(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid), 1); if (unlikely(!__pyx_ptype_5renpy_7display_9gltexture_TextureGrid)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_GetVtable(__pyx_ptype_5renpy_7display_9gltexture_TextureGrid->tp_dict, &__pyx_vtabptr_5renpy_7display_9gltexture_TextureGrid) < 0) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- 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.display.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_7display_9gltexture_blit, "PyObject *(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, PyObject *, 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_7display_9gltexture_blend, "PyObject *(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, PyObject *, 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_7display_9gltexture_imageblend, "PyObject *(struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, struct __pyx_obj_5renpy_7display_9gltexture_TextureGrid *, double, double, struct __pyx_obj_5renpy_7display_6render_Matrix2D *, double, double, int, PyObject *, 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 ---*/

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":26
 * from gl cimport *
 * 
 * import renpy             # <<<<<<<<<<<<<<
 * import pygame
 * import os
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__renpy), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __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 = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":27
 * 
 * import renpy
 * import pygame             # <<<<<<<<<<<<<<
 * import os
 * import os.path
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__pygame), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __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 = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":28
 * import renpy
 * import pygame
 * import os             # <<<<<<<<<<<<<<
 * import os.path
 * import weakref
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__os), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __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 = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":29
 * import pygame
 * import os
 * import os.path             # <<<<<<<<<<<<<<
 * import weakref
 * import array
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_45), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __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 = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":30
 * import os
 * import os.path
 * import weakref             # <<<<<<<<<<<<<<
 * import array
 * import time
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__weakref), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __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 = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":31
 * import os.path
 * import weakref
 * import array             # <<<<<<<<<<<<<<
 * import time
 * 
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__array), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __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 = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":32
 * import weakref
 * import array
 * import time             # <<<<<<<<<<<<<<
 * 
 * cimport renpy.display.gltexture as gltexture
 */
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__time), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __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 = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":37
 * cimport renpy.display.render as render
 * 
 * import renpy.display.gltexture as gltexture             # <<<<<<<<<<<<<<
 * import renpy.display.glenviron as glenviron
 * import renpy.display.glrtt_copy as glrtt_copy
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s_47));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
  __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s_46), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gltexture, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":38
 * 
 * import renpy.display.gltexture as gltexture
 * import renpy.display.glenviron as glenviron             # <<<<<<<<<<<<<<
 * import renpy.display.glrtt_copy as glrtt_copy
 * 
 */
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_4));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
  PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s_47));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_48), ((PyObject *)__pyx_t_4)); 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);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron, __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;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":39
 * import renpy.display.gltexture as gltexture
 * import renpy.display.glenviron as glenviron
 * import renpy.display.glrtt_copy as glrtt_copy             # <<<<<<<<<<<<<<
 * 
 * try:
 */
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
  PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s_47));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
  __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s_49), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glrtt_copy, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":41
 * import renpy.display.glrtt_copy as glrtt_copy
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import renpy.display.glenviron_fixed as glenviron_fixed
 * except ImportError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":42
 * 
 * try:
 *     import renpy.display.glenviron_fixed as glenviron_fixed             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_fixed = None
 */
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
      PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s_47));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_50), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_fixed, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":43
 * try:
 *     import renpy.display.glenviron_fixed as glenviron_fixed
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_fixed = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.display.gldraw");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":44
 *     import renpy.display.glenviron_fixed as 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 = 44; __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_6); __pyx_t_6 = 0;
      goto __pyx_L3_exception_handled;
    }
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L9_try_end:;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":46
 *     glenviron_fixed = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import renpy.display.glenviron_shader as glenviron_shader
 * except ImportError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":47
 * 
 * try:
 *     import renpy.display.glenviron_shader as glenviron_shader             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_shader = None
 */
      __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_6));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
      PyList_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_n_s_47));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
      __pyx_t_4 = __Pyx_Import(((PyObject *)__pyx_n_s_51), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_shader, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L19_try_end;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":48
 * try:
 *     import renpy.display.glenviron_shader as glenviron_shader
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_shader = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.display.gldraw");
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_3);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":49
 *     import renpy.display.glenviron_shader as 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 = 49; __pyx_clineno = __LINE__; goto __pyx_L14_except_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L13_exception_handled;
    }
    __pyx_L14_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L13_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L19_try_end:;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":51
 *     glenviron_shader = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import renpy.display.glenviron_limited as glenviron_limited
 * except ImportError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":52
 * 
 * try:
 *     import renpy.display.glenviron_limited as glenviron_limited             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glenviron_limited = None
 */
      __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_3));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
      PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s_47));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
      __pyx_t_6 = __Pyx_Import(((PyObject *)__pyx_n_s_52), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_limited, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L22_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L29_try_end;
    __pyx_L22_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":53
 * try:
 *     import renpy.display.glenviron_limited as glenviron_limited
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glenviron_limited = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.display.gldraw");
      if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":54
 *     import renpy.display.glenviron_limited as glenviron_limited
 * except ImportError:
 *     glenviron_limited = None             # <<<<<<<<<<<<<<
 * 
 * try:
 */
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glenviron_limited, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L24_except_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L23_exception_handled;
    }
    __pyx_L24_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L23_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L29_try_end:;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":56
 *     glenviron_limited = None
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import renpy.display.glrtt_fbo as glrtt_fbo
 * except ImportError:
 */
  {
    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
    __Pyx_XGOTREF(__pyx_save_exc_type);
    __Pyx_XGOTREF(__pyx_save_exc_value);
    __Pyx_XGOTREF(__pyx_save_exc_tb);
    /*try:*/ {

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":57
 * 
 * try:
 *     import renpy.display.glrtt_fbo as glrtt_fbo             # <<<<<<<<<<<<<<
 * except ImportError:
 *     glrtt_fbo = None
 */
      __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_INCREF(((PyObject *)__pyx_n_s_47));
      PyList_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_n_s_47));
      __Pyx_GIVEREF(((PyObject *)__pyx_n_s_47));
      __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_53), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glrtt_fbo, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L32_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
    goto __pyx_L39_try_end;
    __pyx_L32_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":58
 * try:
 *     import renpy.display.glrtt_fbo as glrtt_fbo
 * except ImportError:             # <<<<<<<<<<<<<<
 *     glrtt_fbo = None
 * 
 */
    __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("renpy.display.gldraw");
      if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L34_except_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);

      /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":59
 *     import renpy.display.glrtt_fbo as glrtt_fbo
 * except ImportError:
 *     glrtt_fbo = None             # <<<<<<<<<<<<<<
 * 
 * 
 */
      if (PyObject_SetAttr(__pyx_m, __pyx_n_s__glrtt_fbo, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L34_except_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L33_exception_handled;
    }
    __pyx_L34_except_error:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    goto __pyx_L1_error;
    __pyx_L33_exception_handled:;
    __Pyx_XGIVEREF(__pyx_save_exc_type);
    __Pyx_XGIVEREF(__pyx_save_exc_value);
    __Pyx_XGIVEREF(__pyx_save_exc_tb);
    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
    __pyx_L39_try_end:;
  }

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":71
 * 
 * # This is used by gl_error_check in gl.pxd.
 * class GLError(Exception):             # <<<<<<<<<<<<<<
 *     """
 *     This is used to report OpenGL errors.
 */
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_6));
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_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_6), "__doc__", ((PyObject *)__pyx_kp_s_54)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = __Pyx_CreateClass(__pyx_t_4, ((PyObject *)__pyx_t_6), __pyx_n_s__GLError, "renpy.display.gldraw"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__GLError, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":80
 * # 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_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__render); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__DISSOLVE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_5renpy_7display_6gldraw_DISSOLVE = __pyx_t_5;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":81
 * 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 = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__render); 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_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__IMAGEDISSOLVE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_6); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_5renpy_7display_6gldraw_IMAGEDISSOLVE = __pyx_t_5;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":82
 * DISSOLVE = renpy.display.render.DISSOLVE
 * IMAGEDISSOLVE = renpy.display.render.IMAGEDISSOLVE
 * PIXELLATE = renpy.display.render.PIXELLATE             # <<<<<<<<<<<<<<
 * 
 * cdef object IDENTITY
 */
  __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__display); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__render); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__PIXELLATE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_5renpy_7display_6gldraw_PIXELLATE = __pyx_t_5;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":85
 * 
 * cdef object IDENTITY
 * IDENTITY = renpy.display.render.IDENTITY             # <<<<<<<<<<<<<<
 * 
 * cdef void gl_clip(GLenum plane, GLdouble a, GLdouble b, GLdouble c, GLdouble d):
 */
  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__renpy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__display); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__render); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__IDENTITY); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_GOTREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_DECREF(__pyx_v_5renpy_7display_6gldraw_IDENTITY);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_v_5renpy_7display_6gldraw_IDENTITY = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":111
 * 
 * BLACKLIST = [
 *     ("S3 Graphics DeltaChrome", "1.4 20.00"),             # <<<<<<<<<<<<<<
 *     ]
 * 
 */
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_55));
  PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_55));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_55));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_56));
  PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_kp_s_56));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_56));
  __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__BLACKLIST, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":547
 *             del self.texture_cache[surf]
 * 
 *     def load_texture(self, surf, transient=False):             # <<<<<<<<<<<<<<
 *         # Turn a surface into a texture grid.
 * 
 */
  __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_k_39 = __pyx_t_3;
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gldraw.pyx":1
 * #cython: profile=False             # <<<<<<<<<<<<<<
 * # Copyright 2004-2011 Tom Rothamel <pytom@bishoujo.us>
 * #
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__set_mode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_57), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__deinit); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_58), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__init); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_59), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__should_redraw); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_60), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__clip_mode_screen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_61), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__clip_mode_rtt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_62), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__draw_screen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_63), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s_41); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_64), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__is_pixel_opaque); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_65), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = PyObject_GetAttr(__pyx_m, __pyx_n_s__GLDraw); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__get_half); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_kp_u_66), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "/home/tom/ab/renpy-mainline/renpy/display/gltexture.pxd":34
 *    cdef list columns
 *    cdef list tiles # list of lists.
 *    cdef public TextureGrid half_cache             # <<<<<<<<<<<<<<
 * 
 *    cdef void make_ready(self, bint nearest)
 */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  if (__pyx_m) {
    __Pyx_AddTraceback("init renpy.display.gldraw");
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init renpy.display.gldraw");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

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 *number, *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";
    }
    number = (num_expected == 1) ? "" : "s";
    PyErr_Format(PyExc_TypeError,
        #if PY_VERSION_HEX < 0x02050000
            "%s() takes %s %d positional argument%s (%d given)",
        #else
            "%s() takes %s %zd positional argument%s (%zd given)",
        #endif
        func_name, more_or_less, num_expected, number, num_found);
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #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;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    return 0;
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
    return 0;
}

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

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

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

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
                 "need more than %d value%s to unpack", (int)index,
        #else
                 "need more than %zd value%s to unpack", index,
        #endif
                 (index == 1) ? "" : "s");
}

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
        #if PY_VERSION_HEX < 0x02050000
            "too many values to unpack (expected %d)", (int)expected);
        #else
            "too many values to unpack (expected %zd)", expected);
        #endif
}

static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred()) {
            __Pyx_RaiseNeedMoreValuesError(index);
        }
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter, Py_ssize_t expected) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

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_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 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 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 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 0;
}

static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
    long q = a / b;
    long r = a - q*b;
    q -= ((r != 0) & ((r ^ b) < 0));
    return q;
}

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) {
    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;
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

static PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, const char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;

    #if PY_MAJOR_VERSION < 3
    py_modname = PyString_FromString(modname);
    #else
    py_modname = PyUnicode_FromString(modname);
    #endif
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    result = PyClass_New(bases, dict, name);
    #else
    result = PyObject_CallFunctionObjArgs((PyObject *)&PyType_Type, name, bases, dict, NULL);
    #endif
bad:
    Py_XDECREF(py_modname);
    return result;
}

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 GLenum __Pyx_PyInt_from_py_GLenum(PyObject* x) {
    const GLenum neg_one = (GLenum)-1, const_zero = (GLenum)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(GLenum) == sizeof(char)) {
        if (is_unsigned)
            return (GLenum)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (GLenum)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(GLenum) == sizeof(short)) {
        if (is_unsigned)
            return (GLenum)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (GLenum)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(GLenum) == sizeof(int)) {
        if (is_unsigned)
            return (GLenum)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (GLenum)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(GLenum) == sizeof(long)) {
        if (is_unsigned)
            return (GLenum)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (GLenum)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(GLenum) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (GLenum)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (GLenum)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        GLenum val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (GLenum)-1;
    }
}


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

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 GLint __Pyx_PyInt_from_py_GLint(PyObject* x) {
    const GLint neg_one = (GLint)-1, const_zero = (GLint)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(GLint) == sizeof(char)) {
        if (is_unsigned)
            return (GLint)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (GLint)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(GLint) == sizeof(short)) {
        if (is_unsigned)
            return (GLint)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (GLint)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(GLint) == sizeof(int)) {
        if (is_unsigned)
            return (GLint)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (GLint)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(GLint) == sizeof(long)) {
        if (is_unsigned)
            return (GLint)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (GLint)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(GLint) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (GLint)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (GLint)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        GLint val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (GLint)-1;
    }
}

static CYTHON_INLINE GLsizei __Pyx_PyInt_from_py_GLsizei(PyObject* x) {
    const GLsizei neg_one = (GLsizei)-1, const_zero = (GLsizei)0;
    const int is_unsigned = const_zero < neg_one;
    if (sizeof(GLsizei) == sizeof(char)) {
        if (is_unsigned)
            return (GLsizei)__Pyx_PyInt_AsUnsignedChar(x);
        else
            return (GLsizei)__Pyx_PyInt_AsSignedChar(x);
    } else if (sizeof(GLsizei) == sizeof(short)) {
        if (is_unsigned)
            return (GLsizei)__Pyx_PyInt_AsUnsignedShort(x);
        else
            return (GLsizei)__Pyx_PyInt_AsSignedShort(x);
    } else if (sizeof(GLsizei) == sizeof(int)) {
        if (is_unsigned)
            return (GLsizei)__Pyx_PyInt_AsUnsignedInt(x);
        else
            return (GLsizei)__Pyx_PyInt_AsSignedInt(x);
    } else if (sizeof(GLsizei) == sizeof(long)) {
        if (is_unsigned)
            return (GLsizei)__Pyx_PyInt_AsUnsignedLong(x);
        else
            return (GLsizei)__Pyx_PyInt_AsSignedLong(x);
    } else if (sizeof(GLsizei) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return (GLsizei)__Pyx_PyInt_AsUnsignedLongLong(x);
        else
            return (GLsizei)__Pyx_PyInt_AsSignedLongLong(x);
    }  else {
        GLsizei val;
        PyObject *v = __Pyx_PyNumber_Int(x);
        #if PY_VERSION_HEX < 0x03000000
        if (likely(v) && !PyLong_Check(v)) {
            PyObject *tmp = v;
            v = PyNumber_Long(tmp);
            Py_DECREF(tmp);
        }
        #endif
        if (likely(v)) {
            int one = 1; int is_little = (int)*(unsigned char *)&one;
            unsigned char *bytes = (unsigned char *)&val;
            int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                          bytes, sizeof(val),
                                          is_little, !is_unsigned);
            Py_DECREF(v);
            if (likely(!ret))
                return val;
        }
        return (GLsizei)-1;
    }
}

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) {
    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) {
    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;
    }

    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 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 PyLong_AsUnsignedLong(x);
        } else {
            return 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 PyLong_AsUnsignedLongLong(x);
        } else {
            return 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 PyLong_AsUnsignedLong(x);
        } else {
            return 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 PyLong_AsUnsignedLongLong(x);
        } else {
            return 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 PyLong_AsUnsignedLong(x);
        } else {
            return 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 PyLong_AsUnsignedLongLong(x);
        } else {
            return 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) {
    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_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,
    long 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 > size) {
        PyOS_snprintf(warning, sizeof(warning), 
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        PyErr_Warn(NULL, warning);
        #else
        PyErr_WarnEx(NULL, warning, 0);
        #endif
    }
    else if (((PyTypeObject *)result)->tp_basicsize != size) {
        PyErr_Format(PyExc_ValueError, 
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return 0;
}
#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 int __Pyx_GetVtable(PyObject *dict, void *vtabptr) {
    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)
    *(void **)vtabptr = PyCapsule_GetPointer(ob, 0);
#else
    *(void **)vtabptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!*(void **)vtabptr)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#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) {
    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 */
