2 // Copyright (c) 2017 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 #ifndef PUBLIC_HWCRECT_H_
18 #define PUBLIC_HWCRECT_H_
24 namespace hwcomposer {
26 // Some of the structs are adopted from drm_hwcomposer
27 template <typename TFloat>
31 TFloat left, top, right, bottom;
39 Rect(TFloat left_, TFloat top_, TFloat right_, TFloat bottom_)
40 : left(left_), top(top_), right(right_), bottom(bottom_) {
43 Rect(const Rect<T> &rhs) {
44 for (int i = 0; i < 4; i++)
45 bounds[i] = rhs.bounds[i];
48 Rect<TFloat> &operator=(const Rect<T> &rhs) {
49 for (int i = 0; i < 4; i++)
50 bounds[i] = rhs.bounds[i];
53 bool operator==(const Rect &rhs) const {
54 for (int i = 0; i < 4; i++) {
55 if (bounds[i] != rhs.bounds[i])
62 for (int i = 0; i < 4; i++) {
70 for (int i = 0; i < 4; i++) {
71 memset(&bounds, 0, sizeof(bounds));
76 } // namespace hwcomposer
78 #endif // PUBLIC_HWCRECT_H_