当前位置: 首页>>代码示例>>Python>>正文


Python DllRetracer.retraceInterfaceMethodBody方法代码示例

本文整理汇总了Python中dllretrace.DllRetracer.retraceInterfaceMethodBody方法的典型用法代码示例。如果您正苦于以下问题:Python DllRetracer.retraceInterfaceMethodBody方法的具体用法?Python DllRetracer.retraceInterfaceMethodBody怎么用?Python DllRetracer.retraceInterfaceMethodBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dllretrace.DllRetracer的用法示例。


在下文中一共展示了DllRetracer.retraceInterfaceMethodBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: retraceInterfaceMethodBody

# 需要导入模块: from dllretrace import DllRetracer [as 别名]
# 或者: from dllretrace.DllRetracer import retraceInterfaceMethodBody [as 别名]
    def retraceInterfaceMethodBody(self, interface, method):
        Retracer.retraceInterfaceMethodBody(self, interface, method)

        # Add pitch swizzling information to the region
        if method.name == 'Map' and interface.name not in ('ID3D10Buffer', 'ID3D10Texture1D'):
            if interface.name.startswith('ID3D11DeviceContext'):
                outArg = method.getArgByName('pMappedResource')
                memberNames = ('pData', 'RowPitch', 'DepthPitch')
            elif interface.name.startswith('ID3D10'):
                outArg = method.args[-1]
                memberNames = ('pData', 'RowPitch', 'DepthPitch')
            elif interface.name == 'IDXGISurface':
                outArg = method.getArgByName('pLockedRect')
                memberNames = ('pBits', 'Pitch', None)
            else:
                raise NotImplementedError
            struct = outArg.type.type
            dataMemberName, rowPitchMemberName, depthPitchMemberName = memberNames
            dataMemberIndex = struct.getMemberByName(dataMemberName)
            rowPitchMemberIndex = struct.getMemberByName(rowPitchMemberName)
            print r'    if (_pbData && %s->%s != 0) {' % (outArg.name, rowPitchMemberName)
            print r'        const trace::Array *_%s = call.arg(%u).toArray();' % (outArg.name, outArg.index)
            print r'        if (%s) {' % outArg.name
            print r'            const trace::Struct *_struct = _%s->values[0]->toStruct();' % (outArg.name)
            print r'            if (_struct) {'
            print r'                unsigned long long traceAddress = _struct->members[%u]->toUIntPtr();' % dataMemberIndex
            print r'                int traceRowPitch = _struct->members[%u]->toSInt();' % rowPitchMemberIndex
            print r'                int realRowPitch = %s->%s;' % (outArg.name, rowPitchMemberName)
            print r'                if (realRowPitch && traceRowPitch != realRowPitch) {'
            print r'                    retrace::setRegionPitch(traceAddress, 2, traceRowPitch, realRowPitch);'
            print r'                }'
            try:
                depthPitchMemberIndex = struct.getMemberByName(depthPitchMemberName)
            except ValueError:
                assert len(struct.members) < 3
                pass
            else:
                assert depthPitchMemberName == 'DepthPitch'
                print r'                if (%s->DepthPitch) {' % outArg.name
                print r'                    retrace::checkMismatch(call, "DepthPitch", _struct->members[%u], %s->DepthPitch);' % (struct.getMemberByName('DepthPitch'), outArg.name)
                print r'                }'
            print r'            }'
            print r'        }'
            print r'    }'
开发者ID:janesma,项目名称:apitrace,代码行数:46,代码来源:dxgiretrace.py


注:本文中的dllretrace.DllRetracer.retraceInterfaceMethodBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。