Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / platform / WebFloatPoint3D.h
blobf061b45ae19205c7b5ea28a5138fb4d57aab4e1d
1 // Copyright 2014 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.
6 #ifndef WebFloatPoint3D_h
7 #define WebFloatPoint3D_h
9 #include "WebCommon.h"
11 #if INSIDE_BLINK
12 #include "platform/geometry/FloatPoint3D.h"
13 #else
14 #include <ui/gfx/geometry/point3_f.h>
15 #endif
17 namespace blink {
19 struct WebFloatPoint3D {
20 float x;
21 float y;
22 float z;
24 WebFloatPoint3D()
25 : x(0.0f)
26 , y(0.0f)
27 , z(0.0f)
31 WebFloatPoint3D(float x, float y, float z)
32 : x(x)
33 , y(y)
34 , z(z)
38 #if INSIDE_BLINK
39 WebFloatPoint3D(const FloatPoint3D& p)
40 : x(p.x())
41 , y(p.y())
42 , z(p.z())
46 WebFloatPoint3D& operator=(const FloatPoint3D& p)
48 x = p.x();
49 y = p.y();
50 z = p.z();
51 return *this;
54 operator FloatPoint3D() const
56 return FloatPoint3D(x, y, z);
58 #else
59 WebFloatPoint3D(const gfx::Point3F& p)
60 : x(p.x())
61 , y(p.y())
62 , z(p.z())
66 WebFloatPoint3D& operator=(const gfx::Point3F& p)
68 x = p.x();
69 y = p.y();
70 return *this;
73 operator gfx::Point3F() const
75 return gfx::Point3F(x, y, z);
78 #endif
81 inline bool operator==(const WebFloatPoint3D& a, const WebFloatPoint3D& b)
83 return a.x == b.x && a.y == b.y && a.z == b.z;
86 inline bool operator!=(const WebFloatPoint3D& a, const WebFloatPoint3D& b)
88 return !(a == b);
91 } // namespace blink
93 #endif