mirror of
https://github.com/reactos/reactos.git
synced 2025-04-28 01:11:35 +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_rubberRadius = 4;
|
||||||
m_transpBg = FALSE;
|
m_transpBg = FALSE;
|
||||||
m_zoom = 1000;
|
m_zoom = 1000;
|
||||||
ZeroMemory(&m_tools, sizeof(m_tools));
|
|
||||||
m_pToolObject = GetOrCreateTool(m_activeTool);
|
m_pToolObject = GetOrCreateTool(m_activeTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolsModel::~ToolsModel()
|
ToolsModel::~ToolsModel()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < _countof(m_tools); ++i)
|
delete m_pToolObject;
|
||||||
delete m_tools[i];
|
m_pToolObject = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolBase *ToolsModel::GetOrCreateTool(TOOLTYPE nTool)
|
ToolBase *ToolsModel::GetOrCreateTool(TOOLTYPE nTool)
|
||||||
{
|
{
|
||||||
if (!m_tools[nTool])
|
delete m_pToolObject;
|
||||||
m_tools[nTool] = ToolBase::createToolObject(nTool);
|
m_pToolObject = ToolBase::createToolObject(nTool);
|
||||||
|
return m_pToolObject;
|
||||||
return m_tools[nTool];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ToolsModel::IsSelection() const
|
BOOL ToolsModel::IsSelection() const
|
||||||
|
|
|
@ -84,7 +84,6 @@ private:
|
||||||
int m_rubberRadius;
|
int m_rubberRadius;
|
||||||
BOOL m_transpBg;
|
BOOL m_transpBg;
|
||||||
int m_zoom;
|
int m_zoom;
|
||||||
ToolBase* m_tools[TOOL_MAX + 1];
|
|
||||||
ToolBase *m_pToolObject;
|
ToolBase *m_pToolObject;
|
||||||
|
|
||||||
ToolBase *GetOrCreateTool(TOOLTYPE nTool);
|
ToolBase *GetOrCreateTool(TOOLTYPE nTool);
|
||||||
|
|
Loading…
Reference in a new issue