print r' }'
if interface.name in self.bufferInterfaceNames and method.name == 'Lock' or \
- interface.name == 'IDirect3DSurface9' and method.name == 'LockRect':
- getDescMethod = interface.getMethodByName('GetDesc')
- descArg = getDescMethod.args[0]
- assert descArg.output
- descType = getDescMethod.args[0].type.type
+ method.name == 'LockRect':
if interface.name in self.bufferInterfaceNames:
+ getDescMethod = interface.getMethodByName('GetDesc')
+ descArg = getDescMethod.args[0]
+ assert descArg.output
+ descType = getDescMethod.args[0].type.type
print ' if (!SizeToLock) {'
print ' %s Desc;' % descType
print ' _this->GetDesc(&Desc);'
print ' SizeToLock = Desc.Size;'
print ' }'
- elif interface.name == 'IDirect3DSurface9':
- print ' UINT Width;'
- print ' UINT Height;'
- print ' if (pRect) {'
- print ' Width = pRect->right - pRect->left;'
- print ' Height = pRect->bottom - pRect->top;'
- print ' } else {'
- print ' %s Desc;' % descType
- print ' _this->GetDesc(&Desc);'
- print ' Width = Desc.Width;'
- print ' Height = Desc.Height;'
- print ' }'
- print ' UINT m_SizeToLock = Height * pLockedRect->Pitch;'
- # TODO: take in consideration the width and pixels and blocks
- print ' (void)Width;'
+ elif method.name == 'LockRect':
+ print ' size_t _LockedSize = _getLockSize(_this, %s);' % ', '.join(method.argNames()[:-1])
+ else:
+ raise NotImplementedError
if __name__ == '__main__':
#include <iostream>
#include "d3d9imports.hpp"
+#include "d3dsize.hpp"
#include "d3dretrace.hpp"
HRESULT hr;
hr = pfnD3DXAssembleShader(pSrcData, strlen(pSrcData), NULL, NULL, 0, &pTokens, NULL);
- if (hr == D3D_OK) {
+ if (SUCCEEDED(hr)) {
return (DWORD *)pTokens->GetBufferPointer();
}