aboutsummaryrefslogtreecommitdiff
path: root/src/ScaleWindowToWindow.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/ScaleWindowToWindow.hh')
-rw-r--r--src/ScaleWindowToWindow.hh19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ScaleWindowToWindow.hh b/src/ScaleWindowToWindow.hh
new file mode 100644
index 0000000..63ab297
--- /dev/null
+++ b/src/ScaleWindowToWindow.hh
@@ -0,0 +1,19 @@
1#ifndef SCALEWINDOWTOWINDOW_HH
2#define SCALEWINDOWTOWINDOW_HH
3
4#include "FbTk/FbWindow.hh"
5
6namespace FbPager {
7template <typename T>
8inline void scaleFromWindowToWindow(const FbTk::FbWindow &src,
9 const FbTk::FbWindow &dest,
10 T &x, T &y) {
11 float xdiv = static_cast<float>(src.width()) / static_cast<float>(dest.width());
12 float ydiv = static_cast<float>(src.height()) / static_cast<float>(dest.height());
13 x = static_cast<T>((float)(x) / xdiv);
14 y = static_cast<T>((float)(y) / ydiv);
15}
16
17} // end namespace FbPager
18
19#endif // SCALEWINDOWTOWINDOW_HH