Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(702)

Side by Side Diff: cc/layer_sorter.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for landing Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_sorter.h ('k') | cc/layer_sorter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/layer_sorter.h" 5 #include "cc/layer_sorter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <limits> 9 #include <limits>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "cc/math_util.h" 13 #include "cc/math_util.h"
14 #include "cc/render_surface_impl.h" 14 #include "cc/render_surface_impl.h"
15 #include <public/WebTransformationMatrix.h> 15 #include "ui/gfx/transform.h"
16 16
17 using namespace std; 17 using namespace std;
18 using WebKit::WebTransformationMatrix;
19 18
20 namespace cc { 19 namespace cc {
21 20
22 inline static float perpProduct(const gfx::Vector2dF& u, const gfx::Vector2dF& v ) 21 inline static float perpProduct(const gfx::Vector2dF& u, const gfx::Vector2dF& v )
23 { 22 {
24 return u.x() * v.y() - u.y() * v.x(); 23 return u.x() * v.y() - u.y() * v.x();
25 } 24 }
26 25
27 // Tests if two edges defined by their endpoints (a,b) and (c,d) intersect. Retu rns true and the 26 // Tests if two edges defined by their endpoints (a,b) and (c,d) intersect. Retu rns true and the
28 // point of intersection if they do and false otherwise. 27 // point of intersection if they do and false otherwise.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (maxDiff <= 0) 138 if (maxDiff <= 0)
140 return ABeforeB; 139 return ABeforeB;
141 140
142 return BBeforeA; 141 return BBeforeA;
143 } 142 }
144 143
145 LayerShape::LayerShape() 144 LayerShape::LayerShape()
146 { 145 {
147 } 146 }
148 147
149 LayerShape::LayerShape(float width, float height, const WebTransformationMatrix& drawTransform) 148 LayerShape::LayerShape(float width, float height, const gfx::Transform& drawTran sform)
150 { 149 {
151 gfx::QuadF layerQuad(gfx::RectF(0, 0, width, height)); 150 gfx::QuadF layerQuad(gfx::RectF(0, 0, width, height));
152 151
153 // Compute the projection of the layer quad onto the z = 0 plane. 152 // Compute the projection of the layer quad onto the z = 0 plane.
154 153
155 gfx::PointF clippedQuad[8]; 154 gfx::PointF clippedQuad[8];
156 int numVerticesInClippedQuad; 155 int numVerticesInClippedQuad;
157 MathUtil::mapClippedQuad(drawTransform, layerQuad, clippedQuad, numVerticesI nClippedQuad); 156 MathUtil::mapClippedQuad(drawTransform, layerQuad, clippedQuad, numVerticesI nClippedQuad);
158 157
159 if (numVerticesInClippedQuad < 3) { 158 if (numVerticesInClippedQuad < 3) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 float maxZ = -FLT_MAX; 222 float maxZ = -FLT_MAX;
224 for (LayerList::const_iterator it = first; it < last; it++) { 223 for (LayerList::const_iterator it = first; it < last; it++) {
225 m_nodes.push_back(GraphNode(*it)); 224 m_nodes.push_back(GraphNode(*it));
226 GraphNode& node = m_nodes.at(m_nodes.size() - 1); 225 GraphNode& node = m_nodes.at(m_nodes.size() - 1);
227 RenderSurfaceImpl* renderSurface = node.layer->renderSurface(); 226 RenderSurfaceImpl* renderSurface = node.layer->renderSurface();
228 if (!node.layer->drawsContent() && !renderSurface) 227 if (!node.layer->drawsContent() && !renderSurface)
229 continue; 228 continue;
230 229
231 DVLOG(2) << "Layer " << node.layer->id() << " (" << node.layer->bounds() .width() << " x " << node.layer->bounds().height() << ")"; 230 DVLOG(2) << "Layer " << node.layer->id() << " (" << node.layer->bounds() .width() << " x " << node.layer->bounds().height() << ")";
232 231
233 WebTransformationMatrix drawTransform; 232 gfx::Transform drawTransform;
234 float layerWidth, layerHeight; 233 float layerWidth, layerHeight;
235 if (renderSurface) { 234 if (renderSurface) {
236 drawTransform = renderSurface->drawTransform(); 235 drawTransform = renderSurface->drawTransform();
237 layerWidth = renderSurface->contentRect().width(); 236 layerWidth = renderSurface->contentRect().width();
238 layerHeight = renderSurface->contentRect().height(); 237 layerHeight = renderSurface->contentRect().height();
239 } else { 238 } else {
240 drawTransform = node.layer->drawTransform(); 239 drawTransform = node.layer->drawTransform();
241 layerWidth = node.layer->contentBounds().width(); 240 layerWidth = node.layer->contentBounds().width();
242 layerHeight = node.layer->contentBounds().height(); 241 layerHeight = node.layer->contentBounds().height();
243 } 242 }
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 *it = sortedList[count++]->layer; 405 *it = sortedList[count++]->layer;
407 406
408 DVLOG(2) << "Sorting end ----"; 407 DVLOG(2) << "Sorting end ----";
409 408
410 m_nodes.clear(); 409 m_nodes.clear();
411 m_edges.clear(); 410 m_edges.clear();
412 m_activeEdges.clear(); 411 m_activeEdges.clear();
413 } 412 }
414 413
415 } // namespace cc 414 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_sorter.h ('k') | cc/layer_sorter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698