16b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian/* 26b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * Copyright 2013 The Android Open Source Project 36b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * 46b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 56b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * you may not use this file except in compliance with the License. 66b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * You may obtain a copy of the License at 76b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * 86b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 96b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * 106b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * Unless required by applicable law or agreed to in writing, software 116b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 126b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * See the License for the specific language governing permissions and 146b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian * limitations under the License. 156b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian */ 166b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian 1771bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza#pragma once 186b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian 196b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopiannamespace android { 206b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian 2171bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stozaclass FloatRect { 225a423eaa86f4c990afcef8c55e3949d0872068b4Dan Stozapublic: 2371bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza FloatRect() = default; 2471bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza constexpr FloatRect(float _left, float _top, float _right, float _bottom) 2571bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza : left(_left), top(_top), right(_right), bottom(_bottom) {} 266b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian 2771bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza float getWidth() const { return right - left; } 2871bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza float getHeight() const { return bottom - top; } 296b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian 3071bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza float left = 0.0f; 3171bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza float top = 0.0f; 3271bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza float right = 0.0f; 3371bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza float bottom = 0.0f; 346b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian}; 356b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian 3671bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stozainline bool operator==(const FloatRect& a, const FloatRect& b) { 3771bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza return a.left == b.left && a.top == b.top && a.right == b.right && a.bottom == b.bottom; 3871bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza} 396b44267a3beb457e220cad0666c039d3a765cdb2Mathias Agopian 4071bded513d37a6c1260b4a62c69ecc0d24be95f7Dan Stoza} // namespace android 41