14e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
24e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
34e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// found in the LICENSE file.
44e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
54e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#ifndef UI_RECT_BASED_TARGETING_UTILS_H_
64e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#define UI_RECT_BASED_TARGETING_UTILS_H_
74e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
84e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#include "ui/views/views_export.h"
94e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)namespace gfx {
114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class Point;
124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class Rect;
134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}
144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
154e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)namespace views {
164e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
174e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Returns true if |rect| is 1x1.
184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)VIEWS_EXPORT bool UsePointBasedTargeting(const gfx::Rect& rect);
194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
204e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)// Returns the percentage of |rect_1|'s area that is covered by |rect_2|.
214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)VIEWS_EXPORT float PercentCoveredBy(const gfx::Rect& rect_1,
224e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                                    const gfx::Rect& rect_2);
234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Returns the square of the distance from |point| to the center of |rect|.
255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)VIEWS_EXPORT int DistanceSquaredFromCenterToPoint(const gfx::Point& point,
265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                                  const gfx::Rect& rect);
274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)}  // namespace views
294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
304e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)#endif  // UI_RECT_BASED_TARGETING_UTILS_H_
31