vfs: check userland buffers before reading them.
[haiku.git] / src / kits / interface / GradientLinear.cpp
blob5df784d5007565dec0452fc8d94ad1b15cba409c
1 /*
2 * Copyright 2006-2008, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Artur Wyszynski <harakash@gmail.com>
7 */
9 #include <Point.h>
10 #include <Gradient.h>
11 #include <GradientLinear.h>
14 // constructor
15 BGradientLinear::BGradientLinear()
17 fData.linear.x1 = 0.0f;
18 fData.linear.y1 = 0.0f;
19 fData.linear.x2 = 0.0f;
20 fData.linear.y2 = 0.0f;
21 fType = TYPE_LINEAR;
25 // constructor
26 BGradientLinear::BGradientLinear(const BPoint& start, const BPoint& end)
28 fData.linear.x1 = start.x;
29 fData.linear.y1 = start.y;
30 fData.linear.x2 = end.x;
31 fData.linear.y2 = end.y;
32 fType = TYPE_LINEAR;
36 // constructor
37 BGradientLinear::BGradientLinear(float x1, float y1, float x2, float y2)
39 fData.linear.x1 = x1;
40 fData.linear.y1 = y1;
41 fData.linear.x2 = x2;
42 fData.linear.y2 = y2;
43 fType = TYPE_LINEAR;
47 // Start
48 BPoint
49 BGradientLinear::Start() const
51 return BPoint(fData.linear.x1, fData.linear.y1);
55 // SetStart
56 void
57 BGradientLinear::SetStart(const BPoint& start)
59 fData.linear.x1 = start.x;
60 fData.linear.y1 = start.y;
64 // SetStart
65 void
66 BGradientLinear::SetStart(float x, float y)
68 fData.linear.x1 = x;
69 fData.linear.y1 = y;
73 // End
74 BPoint
75 BGradientLinear::End() const
77 return BPoint(fData.linear.x2, fData.linear.y2);
81 // SetEnd
82 void
83 BGradientLinear::SetEnd(const BPoint& end)
85 fData.linear.x2 = end.x;
86 fData.linear.y2 = end.y;
90 // SetEnd
91 void
92 BGradientLinear::SetEnd(float x, float y)
94 fData.linear.x2 = x;
95 fData.linear.y2 = y;