| 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 CCLayerQuad { | 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 FloatPoint&, const FloatPoint&); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 76 CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge
& bottom); | 76 LayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge&
bottom); |
| 77 CCLayerQuad(const FloatQuad&); | 77 LayerQuad(const FloatQuad&); |
| 78 | 78 |
| 79 Edge left() const { return m_left; } | 79 Edge left() const { return m_left; } |
| 80 Edge top() const { return m_top; } | 80 Edge top() const { return m_top; } |
| 81 Edge right() const { return m_right; } | 81 Edge right() const { return m_right; } |
| 82 Edge bottom() const { return m_bottom; } | 82 Edge bottom() const { return m_bottom; } |
| 83 | 83 |
| 84 void inflateX(float dx) { m_left.moveZ(dx); m_right.moveZ(dx); } | 84 void inflateX(float dx) { m_left.moveZ(dx); m_right.moveZ(dx); } |
| 85 void inflateY(float dy) { m_top.moveZ(dy); m_bottom.moveZ(dy); } | 85 void inflateY(float dy) { m_top.moveZ(dy); m_bottom.moveZ(dy); } |
| 86 void inflate(float d) { inflateX(d); inflateY(d); } | 86 void inflate(float d) { inflateX(d); inflateY(d); } |
| 87 void inflateAntiAliasingDistance() { inflate(kAntiAliasingInflateDistance);
} | 87 void inflateAntiAliasingDistance() { inflate(kAntiAliasingInflateDistance);
} |
| 88 | 88 |
| 89 FloatQuad floatQuad() const; | 89 FloatQuad floatQuad() const; |
| 90 | 90 |
| 91 void toFloatArray(float[12]) const; | 91 void toFloatArray(float[12]) const; |
| 92 | 92 |
| 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 |