mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 09:00:27 +00:00
[MSPAINT] Simplify tool creation (#5876)
Reduce code and binary size. This will reduce 512 bytes in binary. - Don't use cache for tool creation. CORE-19094
This commit is contained in:
parent
37f56d2448
commit
a6418c848c
2 changed files with 5 additions and 8 deletions
|
@ -22,22 +22,20 @@ ToolsModel::ToolsModel()
|
|||
m_rubberRadius = 4;
|
||||
m_transpBg = FALSE;
|
||||
m_zoom = 1000;
|
||||
ZeroMemory(&m_tools, sizeof(m_tools));
|
||||
m_pToolObject = GetOrCreateTool(m_activeTool);
|
||||
}
|
||||
|
||||
ToolsModel::~ToolsModel()
|
||||
{
|
||||
for (size_t i = 0; i < _countof(m_tools); ++i)
|
||||
delete m_tools[i];
|
||||
delete m_pToolObject;
|
||||
m_pToolObject = NULL;
|
||||
}
|
||||
|
||||
ToolBase *ToolsModel::GetOrCreateTool(TOOLTYPE nTool)
|
||||
{
|
||||
if (!m_tools[nTool])
|
||||
m_tools[nTool] = ToolBase::createToolObject(nTool);
|
||||
|
||||
return m_tools[nTool];
|
||||
delete m_pToolObject;
|
||||
m_pToolObject = ToolBase::createToolObject(nTool);
|
||||
return m_pToolObject;
|
||||
}
|
||||
|
||||
BOOL ToolsModel::IsSelection() const
|
||||
|
|
|
@ -84,7 +84,6 @@ private:
|
|||
int m_rubberRadius;
|
||||
BOOL m_transpBg;
|
||||
int m_zoom;
|
||||
ToolBase* m_tools[TOOL_MAX + 1];
|
||||
ToolBase *m_pToolObject;
|
||||
|
||||
ToolBase *GetOrCreateTool(TOOLTYPE nTool);
|
||||
|
|
Loading…
Reference in a new issue