diff -r 4a4611239021 src/gfxdraw.c
--- a/src/gfxdraw.c Thu Jan 10 14:18:39 2013 +0000
+++ b/src/gfxdraw.c Sun Jan 13 22:30:53 2013 +0100
@@ -237,6 +237,7 @@
PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
return NULL;
}
+
sdlrect = GameRect_FromObject (rect, &temprect);
if (sdlrect == NULL) {
return NULL;
@@ -274,9 +275,8 @@
if (!PyArg_ParseTuple (args, "OOO:box", &surface, &rect, &color)) {
return NULL;
}
-
- if (!PySurface_Check (surface)) {
- PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
+ if (!PyType_IsSubtype(surface->ob_type, &PySurface_Type)) {
+ PyErr_SetString (PyExc_TypeError, "surface must be a subclass
of Surface");
return NULL;
}
sdlrect = GameRect_FromObject (rect, &temprect);
diff -r 4a4611239021 test/gfxdraw_test.py
--- a/test/gfxdraw_test.py Thu Jan 10 14:18:39 2013 +0000
+++ b/test/gfxdraw_test.py Sun Jan 13 22:30:53 2013 +0100
@@ -21,6 +21,12 @@
import pygame.gfxdraw
from pygame.locals import *
+
+class Frame(pygame.Surface,object):
+ def __init__(self,x,y,w,h):
+ pygame.Surface.__init__(self,(w,h), SRCALPHA)
+
+
def intensity(c, i):
"""Return color c changed by intensity i
@@ -707,6 +713,11 @@
self.check_at(surf, posn, bg_adjusted)
+ def test_my(self):
+ """ """
+ pygame.display.set_mode((500,500))
+ fr = Frame(50,50,300,300)
+ pygame.gfxdraw.box(fr,pygame.Rect(0,0,50,50),pygame.Color('red'))
if __name__ == '__main__':
unittest.main()
diff -r 4a4611239021 src/gfxdraw.c
--- a/src/gfxdraw.c Thu Jan 10 14:18:39 2013 +0000
+++ b/src/gfxdraw.c Sun Jan 13 22:30:53 2013 +0100
@@ -237,6 +237,7 @@
PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
return NULL;
}
+
sdlrect = GameRect_FromObject (rect, &temprect);
if (sdlrect == NULL) {
return NULL;
@@ -274,9 +275,8 @@
if (!PyArg_ParseTuple (args, "OOO:box", &surface, &rect, &color)) {
return NULL;
}
-
- if (!PySurface_Check (surface)) {
- PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
+ if (!PyType_IsSubtype(surface->ob_type, &PySurface_Type)) {
+ PyErr_SetString (PyExc_TypeError, "surface must be a subclass of Surface");
return NULL;
}
sdlrect = GameRect_FromObject (rect, &temprect);
diff -r 4a4611239021 test/gfxdraw_test.py
--- a/test/gfxdraw_test.py Thu Jan 10 14:18:39 2013 +0000
+++ b/test/gfxdraw_test.py Sun Jan 13 22:30:53 2013 +0100
@@ -21,6 +21,12 @@
import pygame.gfxdraw
from pygame.locals import *
+
+class Frame(pygame.Surface,object):
+ def __init__(self,x,y,w,h):
+ pygame.Surface.__init__(self,(w,h), SRCALPHA)
+
+
def intensity(c, i):
"""Return color c changed by intensity i
@@ -707,6 +713,11 @@
self.check_at(surf, posn, bg_adjusted)
+ def test_my(self):
+ """ """
+ pygame.display.set_mode((500,500))
+ fr = Frame(50,50,300,300)
+ pygame.gfxdraw.box(fr,pygame.Rect(0,0,50,50),pygame.Color('red'))
if __name__ == '__main__':
unittest.main()