vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / print / drivers / gutenprint / Rectangle.h
blobfff69761318e2f6485cee1053c05046858d5fde7
1 /*
2 * Copyright 2010, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Michael Pfeiffer
7 */
8 #ifndef RECTANGLE_H
9 #define RECTANGLE_H
12 #include <SupportDefs.h>
15 template<typename T>
16 class Rectangle
18 public:
19 Rectangle()
21 left(0),
22 top(0),
23 right(0),
24 bottom(0)
30 Rectangle(const BRect& rect)
32 left(static_cast<T>(rect.left)),
33 top(static_cast<T>(rect.top)),
34 right(static_cast<T>(rect.right)),
35 bottom(static_cast<T>(rect.bottom))
40 Rectangle(T left, T top, T right, T bottom)
42 left(left),
43 top(top),
44 right(right),
45 bottom(bottom)
50 Rectangle<T>& operator=(const BRect& rect) {
51 left = static_cast<T>(rect.left);
52 top = static_cast<T>(rect.top);
53 right = static_cast<T>(rect.right);
54 bottom = static_cast<T>(rect.bottom);
55 return *this;
59 T Width() const {
60 return right - left;
64 T Height() const {
65 return bottom - top;
69 T left;
70 T top;
71 T right;
72 T bottom;
76 typedef Rectangle<int32> RectInt32;
79 #endif