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

Side by Side Diff: cc/layer_quad.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector Created 8 years, 1 month 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_quad.h ('k') | cc/layer_sorter.h » ('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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/layer_quad.h" 7 #include "cc/layer_quad.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 LayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q) 13 LayerQuad::Edge::Edge(const gfx::PointF& p, const gfx::PointF& q)
14 { 14 {
15 DCHECK(p != q); 15 DCHECK(p != q);
16 16
17 FloatPoint tangent(p.y() - q.y(), q.x() - p.x()); 17 gfx::Vector2dF tangent(p.y() - q.y(), q.x() - p.x());
18 float cross2 = p.x() * q.y() - q.x() * p.y(); 18 float cross2 = p.x() * q.y() - q.x() * p.y();
19 19
20 set(tangent.x(), tangent.y(), cross2); 20 set(tangent.x(), tangent.y(), cross2);
21 scale(1.0f / tangent.length()); 21 scale(1.0f / tangent.Length());
22 } 22 }
23 23
24 LayerQuad::LayerQuad(const FloatQuad& quad) 24 LayerQuad::LayerQuad(const FloatQuad& quad)
25 { 25 {
26 // Create edges. 26 // Create edges.
27 m_left = Edge(quad.p4(), quad.p1()); 27 m_left = Edge(quad.p4(), quad.p1());
28 m_right = Edge(quad.p2(), quad.p3()); 28 m_right = Edge(quad.p2(), quad.p3());
29 m_top = Edge(quad.p1(), quad.p2()); 29 m_top = Edge(quad.p1(), quad.p2());
30 m_bottom = Edge(quad.p3(), quad.p4()); 30 m_bottom = Edge(quad.p3(), quad.p4());
31 31
(...skipping 30 matching lines...) Expand all
62 flattened[5] = m_top.z(); 62 flattened[5] = m_top.z();
63 flattened[6] = m_right.x(); 63 flattened[6] = m_right.x();
64 flattened[7] = m_right.y(); 64 flattened[7] = m_right.y();
65 flattened[8] = m_right.z(); 65 flattened[8] = m_right.z();
66 flattened[9] = m_bottom.x(); 66 flattened[9] = m_bottom.x();
67 flattened[10] = m_bottom.y(); 67 flattened[10] = m_bottom.y();
68 flattened[11] = m_bottom.z(); 68 flattened[11] = m_bottom.z();
69 } 69 }
70 70
71 } // namespace cc 71 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_quad.h ('k') | cc/layer_sorter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698