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 #include "config.h" | 6 #include "config.h" |
7 | 7 |
8 #if USE(ACCELERATED_COMPOSITING) | 8 #if USE(ACCELERATED_COMPOSITING) |
9 | 9 |
10 #include "CCLayerQuad.h" | 10 #include "CCLayerQuad.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 m_top = Edge(quad.p1(), quad.p2()); | 30 m_top = Edge(quad.p1(), quad.p2()); |
31 m_bottom = Edge(quad.p3(), quad.p4()); | 31 m_bottom = Edge(quad.p3(), quad.p4()); |
32 | 32 |
33 float sign = quad.isCounterclockwise() ? -1 : 1; | 33 float sign = quad.isCounterclockwise() ? -1 : 1; |
34 m_left.scale(sign); | 34 m_left.scale(sign); |
35 m_right.scale(sign); | 35 m_right.scale(sign); |
36 m_top.scale(sign); | 36 m_top.scale(sign); |
37 m_bottom.scale(sign); | 37 m_bottom.scale(sign); |
38 } | 38 } |
39 | 39 |
| 40 CCLayerQuad::CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, c
onst Edge& bottom) |
| 41 : m_left(left) |
| 42 , m_top(top) |
| 43 , m_right(right) |
| 44 , m_bottom(bottom) |
| 45 { |
| 46 } |
| 47 |
40 FloatQuad CCLayerQuad::floatQuad() const | 48 FloatQuad CCLayerQuad::floatQuad() const |
41 { | 49 { |
42 return FloatQuad(m_left.intersect(m_top), | 50 return FloatQuad(m_left.intersect(m_top), |
43 m_top.intersect(m_right), | 51 m_top.intersect(m_right), |
44 m_right.intersect(m_bottom), | 52 m_right.intersect(m_bottom), |
45 m_bottom.intersect(m_left)); | 53 m_bottom.intersect(m_left)); |
46 } | 54 } |
47 | 55 |
48 void CCLayerQuad::toFloatArray(float flattened[12]) const | 56 void CCLayerQuad::toFloatArray(float flattened[12]) const |
49 { | 57 { |
50 flattened[0] = m_left.x(); | 58 flattened[0] = m_left.x(); |
51 flattened[1] = m_left.y(); | 59 flattened[1] = m_left.y(); |
52 flattened[2] = m_left.z(); | 60 flattened[2] = m_left.z(); |
53 flattened[3] = m_top.x(); | 61 flattened[3] = m_top.x(); |
54 flattened[4] = m_top.y(); | 62 flattened[4] = m_top.y(); |
55 flattened[5] = m_top.z(); | 63 flattened[5] = m_top.z(); |
56 flattened[6] = m_right.x(); | 64 flattened[6] = m_right.x(); |
57 flattened[7] = m_right.y(); | 65 flattened[7] = m_right.y(); |
58 flattened[8] = m_right.z(); | 66 flattened[8] = m_right.z(); |
59 flattened[9] = m_bottom.x(); | 67 flattened[9] = m_bottom.x(); |
60 flattened[10] = m_bottom.y(); | 68 flattened[10] = m_bottom.y(); |
61 flattened[11] = m_bottom.z(); | 69 flattened[11] = m_bottom.z(); |
62 } | 70 } |
63 | 71 |
64 } // namespace cc | 72 } // namespace cc |
65 | 73 |
66 #endif // USE(ACCELERATED_COMPOSITING) | 74 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |