MCPcopy Create free account
hub / github.com/carbonengine/trinity / PyLockBuffer

Function PyLockBuffer

trinity/Tr2AtlasTexture_Blue.cpp:25–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24#if BLUE_WITH_PYTHON
25static 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
52static PyObject* PyLockBufferAndMargin( PyObject* self, PyObject* args )

Callers

nothing calls this directly

Calls 5

MemoryViewRWFunction · 0.85
ToPythonFunction · 0.85
LockBufferMethod · 0.80
GetHeightMethod · 0.45
GetWidthMethod · 0.45

Tested by

no test coverage detected