| 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 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/layer_sorter.h" | 7 #include "cc/layer_sorter.h" |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 projectedQuad.setP1(clippedQuad[0]); | 172 projectedQuad.setP1(clippedQuad[0]); |
| 173 projectedQuad.setP2(clippedQuad[1]); | 173 projectedQuad.setP2(clippedQuad[1]); |
| 174 projectedQuad.setP3(clippedQuad[2]); | 174 projectedQuad.setP3(clippedQuad[2]); |
| 175 if (numVerticesInClippedQuad >= 4) | 175 if (numVerticesInClippedQuad >= 4) |
| 176 projectedQuad.setP4(clippedQuad[3]); | 176 projectedQuad.setP4(clippedQuad[3]); |
| 177 else | 177 else |
| 178 projectedQuad.setP4(clippedQuad[2]); // this will be a degenerate quad t
hat is actually a triangle. | 178 projectedQuad.setP4(clippedQuad[2]); // this will be a degenerate quad t
hat is actually a triangle. |
| 179 | 179 |
| 180 // Compute the normal of the layer's plane. | 180 // Compute the normal of the layer's plane. |
| 181 bool clipped = false; | 181 bool clipped = false; |
| 182 FloatPoint3D c1 = MathUtil::mapPoint(drawTransform, FloatPoint3D(0, 0, 0), c
lipped); | 182 gfx::Point3F c1 = MathUtil::mapPoint(drawTransform, gfx::Point3F(0, 0, 0), c
lipped); |
| 183 FloatPoint3D c2 = MathUtil::mapPoint(drawTransform, FloatPoint3D(0, 1, 0), c
lipped); | 183 gfx::Point3F c2 = MathUtil::mapPoint(drawTransform, gfx::Point3F(0, 1, 0), c
lipped); |
| 184 FloatPoint3D c3 = MathUtil::mapPoint(drawTransform, FloatPoint3D(1, 0, 0), c
lipped); | 184 gfx::Point3F c3 = MathUtil::mapPoint(drawTransform, gfx::Point3F(1, 0, 0), c
lipped); |
| 185 // FIXME: Deal with clipping. | 185 // FIXME: Deal with clipping. |
| 186 FloatPoint3D c12 = c2 - c1; | 186 gfx::Vector3dF c12 = c2 - c1; |
| 187 FloatPoint3D c13 = c3 - c1; | 187 gfx::Vector3dF c13 = c3 - c1; |
| 188 layerNormal = c13.cross(c12); | 188 layerNormal = gfx::CrossProduct(c13, c12); |
| 189 | 189 |
| 190 transformOrigin = c1; | 190 transformOrigin = c1; |
| 191 } | 191 } |
| 192 | 192 |
| 193 LayerShape::~LayerShape() | 193 LayerShape::~LayerShape() |
| 194 { | 194 { |
| 195 } | 195 } |
| 196 | 196 |
| 197 // Returns the Z coordinate of a point on the layer that projects | 197 // Returns the Z coordinate of a point on the layer that projects |
| 198 // to point p which lies on the z = 0 plane. It does it by computing the | 198 // to point p which lies on the z = 0 plane. It does it by computing the |
| 199 // intersection of a line starting from p along the Z axis and the plane | 199 // intersection of a line starting from p along the Z axis and the plane |
| 200 // of the layer. | 200 // of the layer. |
| 201 float LayerShape::layerZFromProjectedPoint(const gfx::PointF& p) const | 201 float LayerShape::layerZFromProjectedPoint(const gfx::PointF& p) const |
| 202 { | 202 { |
| 203 const FloatPoint3D zAxis(0, 0, 1); | 203 gfx::Vector3dF zAxis(0, 0, 1); |
| 204 FloatPoint3D w = FloatPoint3D(cc::FloatPoint(p)) - transformOrigin; | 204 gfx::Vector3dF w = gfx::Point3F(p) - transformOrigin; |
| 205 | 205 |
| 206 float d = layerNormal.dot(zAxis); | 206 float d = gfx::DotProduct(layerNormal, zAxis); |
| 207 float n = -layerNormal.dot(w); | 207 float n = -gfx::DotProduct(layerNormal, w); |
| 208 | 208 |
| 209 // Check if layer is parallel to the z = 0 axis which will make it | 209 // Check if layer is parallel to the z = 0 axis which will make it |
| 210 // invisible and hence returning zero is fine. | 210 // invisible and hence returning zero is fine. |
| 211 if (!d) | 211 if (!d) |
| 212 return 0; | 212 return 0; |
| 213 | 213 |
| 214 // The intersection point would be given by: | 214 // The intersection point would be given by: |
| 215 // p + (n / d) * u but since we are only interested in the | 215 // p + (n / d) * u but since we are only interested in the |
| 216 // z coordinate and p's z coord is zero, all we need is the value of n/d. | 216 // z coordinate and p's z coord is zero, all we need is the value of n/d. |
| 217 return n / d; | 217 return n / d; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 *it = sortedList[count++]->layer; | 407 *it = sortedList[count++]->layer; |
| 408 | 408 |
| 409 DVLOG(2) << "Sorting end ----"; | 409 DVLOG(2) << "Sorting end ----"; |
| 410 | 410 |
| 411 m_nodes.clear(); | 411 m_nodes.clear(); |
| 412 m_edges.clear(); | 412 m_edges.clear(); |
| 413 m_activeEdges.clear(); | 413 m_activeEdges.clear(); |
| 414 } | 414 } |
| 415 | 415 |
| 416 } | 416 } |
| OLD | NEW |