https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a6418c848cc50f21c4459…
commit a6418c848cc50f21c445906c6687db4b29b6aa2f
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Fri Nov 3 16:49:13 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Fri Nov 3 16:49:13 2023 +0900
[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
---
base/applications/mspaint/toolsmodel.cpp | 12 +++++-------
base/applications/mspaint/toolsmodel.h | 1 -
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/base/applications/mspaint/toolsmodel.cpp
b/base/applications/mspaint/toolsmodel.cpp
index a8a7b490803..6efb859066b 100644
--- a/base/applications/mspaint/toolsmodel.cpp
+++ b/base/applications/mspaint/toolsmodel.cpp
@@ -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
diff --git a/base/applications/mspaint/toolsmodel.h
b/base/applications/mspaint/toolsmodel.h
index 51ddb0d46d2..3cd14e8e6d3 100644
--- a/base/applications/mspaint/toolsmodel.h
+++ b/base/applications/mspaint/toolsmodel.h
@@ -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);