Makefile
build
cgltrace.cpp
-d3d1trace.cpp
+d2d1trace.cpp
d3d10trace.cpp
d3d8trace.cpp
d3d9trace.cpp
ddrawtrace.cpp
+dwritetrace.cpp
dxsdk
glproc.hpp
glretrace
install (TARGETS d3d10 LIBRARY DESTINATION wrappers)
endif (DirectX_D3D10_INCLUDE_DIR)
- # d2d1.dll
+ # d2d1.dll, dwrite.dll
if (DirectX_D2D1_INCLUDE_DIR)
include_directories (SYSTEM ${DirectX_D2D1_INCLUDE_DIR})
+
add_custom_command (
OUTPUT d2d1trace.cpp
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/d2d1trace.py > ${CMAKE_CURRENT_BINARY_DIR}/d2d1trace.cpp
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
)
install (TARGETS d2d1 LIBRARY DESTINATION wrappers)
+
+ add_custom_command (
+ OUTPUT dwritetrace.cpp
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dwritetrace.py > ${CMAKE_CURRENT_BINARY_DIR}/dwritetrace.cpp
+ DEPENDS dwritetrace.py trace.py specs/d2d1.py specs/d2d1.py specs/d2dbasetypes.py specs/d2derr.py specs/dwrite.py specs/dcommon.py specs/dxgi.py specs/dxgitype.py specs/dxgiformat.py specs/winapi.py specs/stdapi.py
+ )
+ add_library (dwrite MODULE specs/dwrite.def dwritetrace.cpp)
+ set_target_properties (dwrite
+ PROPERTIES PREFIX ""
+ RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+ LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/wrappers
+ )
+ install (TARGETS dwrite LIBRARY DESTINATION wrappers)
endif (DirectX_D2D1_INCLUDE_DIR)
# opengl32.dll
--- /dev/null
+##########################################################################
+#
+# Copyright 2008-2009 VMware, Inc.
+# All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+##########################################################################/
+
+
+from trace import DllTracer
+from specs.dwrite import dwrite
+from specs.d2d1 import d2d1 # cyclic dependency
+
+
+class D2D1Tracer(DllTracer):
+
+ def wrap_arg(self, function, arg):
+ if function.name == 'D2D1CreateFactory' and arg.output:
+ print ' if (*%s) {' % arg.name
+ for iface in d2d1.interfaces:
+ print ' if (riid == IID_%s) {' % iface.name
+ print ' *%s = (%s) new Wrap%s((%s *)*%s);' % (arg.name, arg.type, iface.name, iface.name, arg.name)
+ print ' }'
+ print ' }'
+
+ DllTracer.wrap_arg(self, function, arg)
+
+
+if __name__ == '__main__':
+ print '#define INITGUID'
+ print
+ print '#include "trace_writer.hpp"'
+ print '#include "os.hpp"'
+ print
+ print '#include <windows.h>'
+ print
+ print '#include "compat.h"'
+ print
+ print '#define DWRITE_EXPORT WINAPI'
+ print
+ print '#include <d2d1.h>'
+ print '#include <dwrite.h>'
+ print
+ print 'DEFINE_GUID(IID_IDWriteFactory,0xb859ee5a,0xd838,0x4b5b,0xa2,0xe8,0x1a,0xdc,0x7d,0x93,0xdb,0x48);'
+ print
+
+ tracer = D2D1Tracer('dwrite.dll')
+ tracer.trace_api(dwrite)
--- /dev/null
+LIBRARY "d2d1"
+
+EXPORTS
+ DWriteCreateFactory
Method(FLOAT, "GetIncrementalTabStop", []),
Method(HRESULT, "GetTrimming", [Out(Pointer(DWRITE_TRIMMING), "trimmingOptions"), Out(Pointer(Pointer(IDWriteInlineObject)), "trimmingSign")]),
Method(HRESULT, "GetLineSpacing", [Out(Pointer(DWRITE_LINE_SPACING_METHOD), "lineSpacingMethod"), Out(Pointer(FLOAT), "lineSpacing"), Out(Pointer(FLOAT), "baseline")]),
- #Method(HRESULT, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
- #Method(UINT32, "GetFontFamilyNameLength", []),
- #Method(HRESULT, "GetFontFamilyName", [Out(Pointer(WCHAR), "fontFamilyName"), (UINT32, "nameSize")]),
- #Method(DWRITE_FONT_WEIGHT, "GetFontWeight", []),
- #Method(DWRITE_FONT_STYLE, "GetFontStyle", []),
- #Method(DWRITE_FONT_STRETCH, "GetFontStretch", []),
- #Method(FLOAT, "GetFontSize", []),
- #Method(UINT32, "GetLocaleNameLength", []),
- #Method(HRESULT, "GetLocaleName", [Out(Pointer(WCHAR), "localeName"), (UINT32, "nameSize")]),
+ Method(HRESULT, "GetFontCollection", [Out(Pointer(Pointer(IDWriteFontCollection)), "fontCollection")]),
+ Method(UINT32, "GetFontFamilyNameLength", []),
+ Method(HRESULT, "GetFontFamilyName", [Out(Pointer(WCHAR), "fontFamilyName"), (UINT32, "nameSize")]),
+ Method(DWRITE_FONT_WEIGHT, "GetFontWeight", []),
+ Method(DWRITE_FONT_STYLE, "GetFontStyle", []),
+ Method(DWRITE_FONT_STRETCH, "GetFontStretch", []),
+ Method(FLOAT, "GetFontSize", []),
+ Method(UINT32, "GetLocaleNameLength", []),
+ Method(HRESULT, "GetLocaleName", [Out(Pointer(WCHAR), "localeName"), (UINT32, "nameSize")]),
]
IDWriteTypography.methods += [
]
dwrite = API("dwrite")
+dwrite.add_interface(IDWriteFactory)
dwrite.add_functions([
StdFunction(HRESULT, "DWriteCreateFactory", [(DWRITE_FACTORY_TYPE, "factoryType"), (REFIID, "iid"), Out(Pointer(Pointer(IUnknown)), "factory")]),
])
for method in self.methods:
yield method
raise StopIteration
+
+ def itermethods2(self):
+ if self.base is not None:
+ for iface, method in self.base.itermethods2():
+ yield iface, method
+ for method in self.methods:
+ yield self, method
+ raise StopIteration
class Method(Function):
print '%s::~%s() {' % (interface_wrap_name(interface), interface_wrap_name(interface))
print '}'
print
- for method in interface.itermethods():
- self.trace_method(interface, method)
+ for base, method in interface.itermethods2():
+ self.trace_method(interface, base, method)
print
- def trace_method(self, interface, method):
+ def trace_method(self, interface, base, method):
print method.prototype(interface_wrap_name(interface) + '::' + method.name) + ' {'
print ' static const char * __args[%u] = {%s};' % (len(method.args) + 1, ', '.join(['"this"'] + ['"%s"' % arg.name for arg in method.args]))
print ' static const Trace::FunctionSig __sig = {%u, "%s", %u, __args};' % (int(method.id), interface.name + '::' + method.name, len(method.args) + 1)
print ' %s __result;' % method.type
result = '__result = '
print ' Trace::localWriter.endEnter();'
- print ' %sm_pInstance->%s(%s);' % (result, method.name, ', '.join([str(arg.name) for arg in method.args]))
+ print ' %sstatic_cast<%s *>(m_pInstance)->%s(%s);' % (result, base, method.name, ', '.join([str(arg.name) for arg in method.args]))
print ' Trace::localWriter.beginLeave(__call);'
for arg in method.args:
if arg.output: