OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 #ifndef CCLayerQuad_h | 6 #ifndef CCLayerQuad_h |
7 #define CCLayerQuad_h | 7 #define CCLayerQuad_h |
8 | 8 |
9 #include "FloatPoint3D.h" | 9 #include "FloatPoint3D.h" |
10 #include "FloatQuad.h" | 10 #include "FloatQuad.h" |
11 | 11 |
12 static const float kAntiAliasingInflateDistance = 0.5f; | 12 static const float kAntiAliasingInflateDistance = 0.5f; |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 class LayerQuad { | 16 class LayerQuad { |
17 public: | 17 public: |
18 class Edge { | 18 class Edge { |
19 public: | 19 public: |
20 Edge() | 20 Edge() |
21 : m_x(0) | 21 : m_x(0) |
22 , m_y(0) | 22 , m_y(0) |
23 , m_z(0) | 23 , m_z(0) |
24 { | 24 { |
25 } | 25 } |
26 Edge(const FloatPoint&, const FloatPoint&); | 26 Edge(const gfx::PointF&, const gfx::PointF&); |
27 | 27 |
28 float x() const { return m_x; } | 28 float x() const { return m_x; } |
29 float y() const { return m_y; } | 29 float y() const { return m_y; } |
30 float z() const { return m_z; } | 30 float z() const { return m_z; } |
31 | 31 |
32 void setX(float x) { m_x = x; } | 32 void setX(float x) { m_x = x; } |
33 void setY(float y) { m_y = y; } | 33 void setY(float y) { m_y = y; } |
34 void setZ(float z) { m_z = z; } | 34 void setZ(float z) { m_z = z; } |
35 void set(float x, float y, float z) | 35 void set(float x, float y, float z) |
36 { | 36 { |
(...skipping 16 matching lines...) Expand all Loading... | |
53 void scaleY(float sy) { m_y *= sy; } | 53 void scaleY(float sy) { m_y *= sy; } |
54 void scaleZ(float sz) { m_z *= sz; } | 54 void scaleZ(float sz) { m_z *= sz; } |
55 void scale(float sx, float sy, float sz) | 55 void scale(float sx, float sy, float sz) |
56 { | 56 { |
57 m_x *= sx; | 57 m_x *= sx; |
58 m_y *= sy; | 58 m_y *= sy; |
59 m_z *= sz; | 59 m_z *= sz; |
60 } | 60 } |
61 void scale(float s) { scale(s, s, s); } | 61 void scale(float s) { scale(s, s, s); } |
62 | 62 |
63 FloatPoint intersect(const Edge& e) const | 63 gfx::PointF intersect(const Edge& e) const |
64 { | 64 { |
65 return FloatPoint( | 65 return FloatPoint( |
enne (OOO)
2012/10/29 22:23:47
Don't rely on implicit conversion here.
danakj
2012/10/31 19:45:43
Oh, thanks. I just missed that one.
| |
66 (y() * e.z() - e.y() * z()) / (x() * e.y() - e.x() * y()), | 66 (y() * e.z() - e.y() * z()) / (x() * e.y() - e.x() * y()), |
67 (x() * e.z() - e.x() * z()) / (e.x() * y() - x() * e.y())); | 67 (x() * e.z() - e.x() * z()) / (e.x() * y() - x() * e.y())); |
68 } | 68 } |
69 | 69 |
70 private: | 70 private: |
71 float m_x; | 71 float m_x; |
72 float m_y; | 72 float m_y; |
73 float m_z; | 73 float m_z; |
74 }; | 74 }; |
75 | 75 |
(...skipping 17 matching lines...) Expand all Loading... | |
93 private: | 93 private: |
94 Edge m_left; | 94 Edge m_left; |
95 Edge m_top; | 95 Edge m_top; |
96 Edge m_right; | 96 Edge m_right; |
97 Edge m_bottom; | 97 Edge m_bottom; |
98 }; | 98 }; |
99 | 99 |
100 } | 100 } |
101 | 101 |
102 #endif | 102 #endif |
OLD | NEW |