Use wxList instead of std::list in Direct2D renderer.
This would remove explicit dependency on STL.
This commit is contained in:
@@ -14,8 +14,6 @@
|
|||||||
// Minimum supported client: Windows 8 and Platform Update for Windows 7
|
// Minimum supported client: Windows 8 and Platform Update for Windows 7
|
||||||
#define wxD2D_DEVICE_CONTEXT_SUPPORTED 0
|
#define wxD2D_DEVICE_CONTEXT_SUPPORTED 0
|
||||||
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
// Ensure no previous defines interfere with the Direct2D API headers
|
// Ensure no previous defines interfere with the Direct2D API headers
|
||||||
#undef GetHwnd
|
#undef GetHwnd
|
||||||
|
|
||||||
@@ -346,28 +344,28 @@ public:
|
|||||||
// A Direct2D resource manager handles the device-dependent
|
// A Direct2D resource manager handles the device-dependent
|
||||||
// resource holders attached to it by requesting them to
|
// resource holders attached to it by requesting them to
|
||||||
// release their resources when the API invalidates.
|
// release their resources when the API invalidates.
|
||||||
|
// NOTE: We're using a list because we expect to have multiple
|
||||||
|
// insertions but very rarely a traversal (if ever).
|
||||||
|
WX_DECLARE_LIST(wxManagedResourceHolder, wxManagedResourceListType);
|
||||||
|
#include <wx/listimpl.cpp>
|
||||||
|
WX_DEFINE_LIST(wxManagedResourceListType);
|
||||||
|
|
||||||
class wxD2DResourceManager: public wxD2DContextSupplier
|
class wxD2DResourceManager: public wxD2DContextSupplier
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef wxManagedResourceHolder* ElementType;
|
void RegisterResourceHolder(wxManagedResourceHolder* resourceHolder)
|
||||||
|
|
||||||
// NOTE: We're using a list because we expect to have multiple
|
|
||||||
// insertions but very rarely a traversal (if ever).
|
|
||||||
typedef std::list<ElementType> ListType;
|
|
||||||
|
|
||||||
void RegisterResourceHolder(ElementType resourceHolder)
|
|
||||||
{
|
{
|
||||||
m_resources.push_back(resourceHolder);
|
m_resources.push_back(resourceHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterResourceHolder(ElementType resourceHolder)
|
void UnregisterResourceHolder(wxManagedResourceHolder* resourceHolder)
|
||||||
{
|
{
|
||||||
m_resources.remove(resourceHolder);
|
m_resources.remove(resourceHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReleaseResources()
|
void ReleaseResources()
|
||||||
{
|
{
|
||||||
ListType::iterator it;
|
wxManagedResourceListType::iterator it;
|
||||||
for (it = m_resources.begin(); it != m_resources.end(); ++it)
|
for (it = m_resources.begin(); it != m_resources.end(); ++it)
|
||||||
{
|
{
|
||||||
(*it)->ReleaseResource();
|
(*it)->ReleaseResource();
|
||||||
@@ -390,7 +388,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ListType m_resources;
|
wxManagedResourceListType m_resources;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A Direct2D resource holder manages device dependent resources
|
// A Direct2D resource holder manages device dependent resources
|
||||||
|
Reference in New Issue
Block a user