| 23 | |
| 24 | #if BLUE_WITH_PYTHON |
| 25 | static PyObject* PyLockBuffer( PyObject* self, PyObject* args ) |
| 26 | { |
| 27 | Tr2AtlasTexture* pThis = BluePythonCast<Tr2AtlasTexture*>( self ); |
| 28 | |
| 29 | void* pData = NULL; |
| 30 | unsigned int pitch = 0; |
| 31 | if( pThis->LockBuffer( pData, pitch ) ) |
| 32 | { |
| 33 | PyObject* buffer = PyVerCompat::MemoryViewRW( pData, pThis->GetHeight() * pitch ); |
| 34 | PyObject* result = PyTuple_New( 4 ); |
| 35 | if( !result ) |
| 36 | { |
| 37 | Py_DECREF( buffer ); |
| 38 | return nullptr; |
| 39 | } |
| 40 | PyTuple_SET_ITEM( result, 0, buffer ); |
| 41 | PyTuple_SET_ITEM( result, 1, ToPython( pThis->GetWidth() ) ); |
| 42 | PyTuple_SET_ITEM( result, 2, ToPython( pThis->GetHeight() ) ); |
| 43 | PyTuple_SET_ITEM( result, 3, ToPython( pitch ) ); |
| 44 | |
| 45 | return result; |
| 46 | } |
| 47 | |
| 48 | Py_RETURN_FALSE; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | static PyObject* PyLockBufferAndMargin( PyObject* self, PyObject* args ) |
nothing calls this directly
no test coverage detected