diff options
author | crupest <crupest@outlook.com> | 2018-09-10 23:58:34 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2018-09-10 23:58:34 +0800 |
commit | 9250f4d919bc800fe66a50a0874183458e6ebbbe (patch) | |
tree | 1d25285801a6d92cfa8bde6dd0d13433e05d4c04 /CruUI/graph/graph.cpp | |
parent | aa8ba64f4f580552ba14325dd3e04f38a3c9a1de (diff) | |
download | cru-9250f4d919bc800fe66a50a0874183458e6ebbbe.tar.gz cru-9250f4d919bc800fe66a50a0874183458e6ebbbe.tar.bz2 cru-9250f4d919bc800fe66a50a0874183458e6ebbbe.zip |
...
Diffstat (limited to 'CruUI/graph/graph.cpp')
-rw-r--r-- | CruUI/graph/graph.cpp | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/CruUI/graph/graph.cpp b/CruUI/graph/graph.cpp index 4f65a86c..00d5137d 100644 --- a/CruUI/graph/graph.cpp +++ b/CruUI/graph/graph.cpp @@ -200,7 +200,7 @@ namespace cru { return std::make_shared<WindowRenderTarget>(this, hwnd); } - Dpi GraphManager::GetDpi() + Dpi GraphManager::GetDpi() const { Dpi dpi; d2d1_factory_->GetDesktopDpi(&dpi.x, &dpi.y); @@ -213,35 +213,5 @@ namespace cru { d2d1_factory_->ReloadSystemMetrics() ); } - - inline int DipToPixelInternal(float dip, float dpi) - { - return static_cast<int>(dip * dpi / 96.0f); - } - - int DipToPixelX(float dipX) - { - return DipToPixelInternal(dipX, Application::GetInstance()->GetGraphManager()->GetDpi().x); - } - - int DipToPixelY(float dipY) - { - return DipToPixelInternal(dipY, Application::GetInstance()->GetGraphManager()->GetDpi().y); - } - - inline float DipToPixelInternal(int pixel, float dpi) - { - return static_cast<float>(pixel) * 96.0f / dpi; - } - - float PixelToDipX(int pixelX) - { - return DipToPixelInternal(pixelX, Application::GetInstance()->GetGraphManager()->GetDpi().x); - } - - float PixelToDipY(int pixelY) - { - return DipToPixelInternal(pixelY, Application::GetInstance()->GetGraphManager()->GetDpi().y); - } } } |