fat: Greatly simplify and clean up dosfs_get_file_map().
[haiku.git] / src / preferences / screensaver / Utility.h
blobe9f402c96451dac1fe0878c07d96420f66fbba82
1 #ifndef UTILITY_H
2 #define UTILITY_H
5 #include <Rect.h>
8 inline BPoint
9 scale_direct(float x, float y, BRect area)
11 return BPoint(area.Width() * x + area.left, area.Height() * y + area.top);
15 inline BRect
16 scale_direct(float x1, float x2, float y1, float y2, BRect area)
18 return BRect(area.Width() * x1 + area.left, area.Height() * y1 + area.top,
19 area.Width()* x2 + area.left, area.Height() * y2 + area.top);
22 static const float kPositionalX[] = { 0, 0.1, 0.25, 0.3, 0.7, 0.75, 0.9, 1.0 };
23 static const float kPositionalY[] = { 0, 0.1, 0.7, 0.8, 0.9, 1.0 };
25 inline BPoint
26 scale(int x, int y,BRect area)
28 return scale_direct(kPositionalX[x], kPositionalY[y], area);
32 inline BRect
33 scale(int x1, int x2, int y1, int y2,BRect area)
35 return scale_direct(kPositionalX[x1], kPositionalX[x2],
36 kPositionalY[y1], kPositionalY[y2], area);
40 #endif // UTILITY_H