aboutsummaryrefslogtreecommitdiff
path: root/src/graph
diff options
context:
space:
mode:
Diffstat (limited to 'src/graph')
-rw-r--r--src/graph/graph.cpp5
-rw-r--r--src/graph/graph.hpp15
2 files changed, 12 insertions, 8 deletions
diff --git a/src/graph/graph.cpp b/src/graph/graph.cpp
index febb7fee..d37b5e2d 100644
--- a/src/graph/graph.cpp
+++ b/src/graph/graph.cpp
@@ -116,7 +116,10 @@ namespace cru::graph
GraphManager* GraphManager::GetInstance()
{
- return Application::GetInstance()->GetGraphManager();
+ return Application::GetInstance()->ResolveSingleton<GraphManager>([](auto)
+ {
+ return new GraphManager{};
+ });
}
GraphManager::GraphManager()
diff --git a/src/graph/graph.hpp b/src/graph/graph.hpp
index 9ef2e4b8..b98db5f4 100644
--- a/src/graph/graph.hpp
+++ b/src/graph/graph.hpp
@@ -2,9 +2,9 @@
#include "system_headers.hpp"
#include <memory>
+#include <functional>
#include "base.hpp"
-#include "application.hpp"
namespace cru::graph
@@ -62,13 +62,14 @@ namespace cru::graph
float y;
};
- class GraphManager : public Object
+ class GraphManager final : public Object
{
public:
static GraphManager* GetInstance();
- public:
+ private:
GraphManager();
+ public:
GraphManager(const GraphManager& other) = delete;
GraphManager(GraphManager&& other) = delete;
GraphManager& operator=(const GraphManager& other) = delete;
@@ -135,12 +136,12 @@ namespace cru::graph
inline int DipToPixelX(const float dip_x)
{
- return DipToPixelInternal(dip_x, Application::GetInstance()->GetGraphManager()->GetDpi().x);
+ return DipToPixelInternal(dip_x, GraphManager::GetInstance()->GetDpi().x);
}
inline int DipToPixelY(const float dip_y)
{
- return DipToPixelInternal(dip_y, Application::GetInstance()->GetGraphManager()->GetDpi().y);
+ return DipToPixelInternal(dip_y, GraphManager::GetInstance()->GetDpi().y);
}
inline float DipToPixelInternal(const int pixel, const float dpi)
@@ -150,12 +151,12 @@ namespace cru::graph
inline float PixelToDipX(const int pixel_x)
{
- return DipToPixelInternal(pixel_x, Application::GetInstance()->GetGraphManager()->GetDpi().x);
+ return DipToPixelInternal(pixel_x, GraphManager::GetInstance()->GetDpi().x);
}
inline float PixelToDipY(const int pixel_y)
{
- return DipToPixelInternal(pixel_y, Application::GetInstance()->GetGraphManager()->GetDpi().y);
+ return DipToPixelInternal(pixel_y, GraphManager::GetInstance()->GetDpi().y);
}
Microsoft::WRL::ComPtr<ID2D1DeviceContext> WindowRenderTarget::GetD2DDeviceContext() const