aboutsummaryrefslogtreecommitdiffstats
path: root/PySide/QtOpenGL/typesystem_opengl.xml
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-08 14:35:38 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:56 -0300
commit280d68ca34debebfeb9172420598a15ba576eb7e (patch)
treefd64da47e26e1c10c760f6be5331ed16b1b19544 /PySide/QtOpenGL/typesystem_opengl.xml
parent8cb71269c6273133710cfee3759cbbbf20ec6292 (diff)
Fix QGLBuffer::map code injection and test.
Diffstat (limited to 'PySide/QtOpenGL/typesystem_opengl.xml')
-rw-r--r--PySide/QtOpenGL/typesystem_opengl.xml18
1 files changed, 12 insertions, 6 deletions
diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml
index cef742dcd..6ff9614db 100644
--- a/PySide/QtOpenGL/typesystem_opengl.xml
+++ b/PySide/QtOpenGL/typesystem_opengl.xml
@@ -123,12 +123,18 @@
</inject-code>
</modify-function>
<modify-function signature="map(QGLBuffer::Access)">
- <inject-code class="target" position="beginning">
- void *data = %CPPSELF.map(%1);
- QByteArray ret;
- if (data)
- ret.append((const char*)data, %CPPSELF.size());
- %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ret);
+ <inject-code>
+ Py_ssize_t dataSize = %CPPSELF.size();
+ void* data = %CPPSELF.map(%1);
+
+ if (!data) {
+ Py_INCREF(Py_None);
+ %PYARG_0 = Py_None;
+ } else if (%1 == QGLBuffer::ReadOnly) {
+ %PYARG_0 = PyBuffer_FromMemory(data, dataSize);
+ } else {
+ %PYARG_0 = PyBuffer_FromReadWriteMemory(data, dataSize);
+ }
</inject-code>
</modify-function>
<modify-function signature="read(int, void*, int)">