1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gfx/geometry/point.h"
10 #include <CoreGraphics/CoreGraphics.h>
11 #elif defined(OS_MACOSX)
12 #include <ApplicationServices/ApplicationServices.h>
15 #include "base/strings/stringprintf.h"
20 Point::Point(DWORD point
) {
21 POINTS points
= MAKEPOINTS(point
);
26 Point::Point(const POINT
& point
) : x_(point
.x
), y_(point
.y
) {
29 Point
& Point::operator=(const POINT
& point
) {
34 #elif defined(OS_MACOSX)
35 Point::Point(const CGPoint
& point
) : x_(point
.x
), y_(point
.y
) {
40 POINT
Point::ToPOINT() const {
46 #elif defined(OS_MACOSX)
47 CGPoint
Point::ToCGPoint() const {
48 return CGPointMake(x(), y());
52 void Point::SetToMin(const Point
& other
) {
53 x_
= x_
<= other
.x_
? x_
: other
.x_
;
54 y_
= y_
<= other
.y_
? y_
: other
.y_
;
57 void Point::SetToMax(const Point
& other
) {
58 x_
= x_
>= other
.x_
? x_
: other
.x_
;
59 y_
= y_
>= other
.y_
? y_
: other
.y_
;
62 std::string
Point::ToString() const {
63 return base::StringPrintf("%d,%d", x(), y());