| 123 | } |
| 124 | |
| 125 | PyObject* Tr2HostBitmap::PySetMipRawData( PyObject* self, PyObject* args ) |
| 126 | { |
| 127 | unsigned int mipLevel = 0; |
| 128 | Py_buffer buffer; |
| 129 | if( !PyArg_ParseTuple( args, "iw*", &mipLevel, &buffer ) ) |
| 130 | return nullptr; |
| 131 | ON_BLOCK_EXIT( [&] { PyBuffer_Release( &buffer ); } ); |
| 132 | |
| 133 | Tr2HostBitmap* pThis = BluePythonCast<Tr2HostBitmap*>( self ); |
| 134 | if( !pThis->IsValid() ) |
| 135 | { |
| 136 | PyErr_SetString( PyExc_ValueError, "invalid bitmap" ); |
| 137 | return nullptr; |
| 138 | } |
| 139 | |
| 140 | if( mipLevel >= pThis->GetTrueMipCount() ) |
| 141 | { |
| 142 | PyErr_SetString( PyExc_ValueError, "mip level out of range" ); |
| 143 | return nullptr; |
| 144 | } |
| 145 | |
| 146 | if( buffer.len < Py_ssize_t( pThis->GetMipSize( mipLevel ) ) ) |
| 147 | { |
| 148 | PyErr_SetString( PyExc_ValueError, "buffer too small" ); |
| 149 | return nullptr; |
| 150 | } |
| 151 | |
| 152 | memcpy( pThis->GetMipRawData( mipLevel ), buffer.buf, pThis->GetMipSize( mipLevel ) ); |
| 153 | Py_RETURN_NONE; |
| 154 | } |
| 155 | |
| 156 | |
| 157 | PyObject* Tr2HostBitmap::PyCreateFromFile( PyObject* args ) |
nothing calls this directly
no test coverage detected