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

Side by Side Diff: cc/layer_quad.cc

Issue 11189043: cc: Rename cc classes and members to match filenames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months 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
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 5
6 #include "config.h" 6 #include "config.h"
7 7
8 #include "CCLayerQuad.h" 8 #include "CCLayerQuad.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 CCLayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q) 12 LayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q)
13 { 13 {
14 ASSERT(p != q); 14 ASSERT(p != q);
15 15
16 FloatPoint tangent(p.y() - q.y(), q.x() - p.x()); 16 FloatPoint tangent(p.y() - q.y(), q.x() - p.x());
17 float cross2 = p.x() * q.y() - q.x() * p.y(); 17 float cross2 = p.x() * q.y() - q.x() * p.y();
18 18
19 set(tangent.x(), tangent.y(), cross2); 19 set(tangent.x(), tangent.y(), cross2);
20 scale(1.0f / tangent.length()); 20 scale(1.0f / tangent.length());
21 } 21 }
22 22
23 CCLayerQuad::CCLayerQuad(const FloatQuad& quad) 23 LayerQuad::LayerQuad(const FloatQuad& quad)
24 { 24 {
25 // Create edges. 25 // Create edges.
26 m_left = Edge(quad.p4(), quad.p1()); 26 m_left = Edge(quad.p4(), quad.p1());
27 m_right = Edge(quad.p2(), quad.p3()); 27 m_right = Edge(quad.p2(), quad.p3());
28 m_top = Edge(quad.p1(), quad.p2()); 28 m_top = Edge(quad.p1(), quad.p2());
29 m_bottom = Edge(quad.p3(), quad.p4()); 29 m_bottom = Edge(quad.p3(), quad.p4());
30 30
31 float sign = quad.isCounterclockwise() ? -1 : 1; 31 float sign = quad.isCounterclockwise() ? -1 : 1;
32 m_left.scale(sign); 32 m_left.scale(sign);
33 m_right.scale(sign); 33 m_right.scale(sign);
34 m_top.scale(sign); 34 m_top.scale(sign);
35 m_bottom.scale(sign); 35 m_bottom.scale(sign);
36 } 36 }
37 37
38 CCLayerQuad::CCLayerQuad(const Edge& left, const Edge& top, const Edge& right, c onst Edge& bottom) 38 LayerQuad::LayerQuad(const Edge& left, const Edge& top, const Edge& right, const Edge& bottom)
39 : m_left(left) 39 : m_left(left)
40 , m_top(top) 40 , m_top(top)
41 , m_right(right) 41 , m_right(right)
42 , m_bottom(bottom) 42 , m_bottom(bottom)
43 { 43 {
44 } 44 }
45 45
46 FloatQuad CCLayerQuad::floatQuad() const 46 FloatQuad LayerQuad::floatQuad() const
47 { 47 {
48 return FloatQuad(m_left.intersect(m_top), 48 return FloatQuad(m_left.intersect(m_top),
49 m_top.intersect(m_right), 49 m_top.intersect(m_right),
50 m_right.intersect(m_bottom), 50 m_right.intersect(m_bottom),
51 m_bottom.intersect(m_left)); 51 m_bottom.intersect(m_left));
52 } 52 }
53 53
54 void CCLayerQuad::toFloatArray(float flattened[12]) const 54 void LayerQuad::toFloatArray(float flattened[12]) const
55 { 55 {
56 flattened[0] = m_left.x(); 56 flattened[0] = m_left.x();
57 flattened[1] = m_left.y(); 57 flattened[1] = m_left.y();
58 flattened[2] = m_left.z(); 58 flattened[2] = m_left.z();
59 flattened[3] = m_top.x(); 59 flattened[3] = m_top.x();
60 flattened[4] = m_top.y(); 60 flattened[4] = m_top.y();
61 flattened[5] = m_top.z(); 61 flattened[5] = m_top.z();
62 flattened[6] = m_right.x(); 62 flattened[6] = m_right.x();
63 flattened[7] = m_right.y(); 63 flattened[7] = m_right.y();
64 flattened[8] = m_right.z(); 64 flattened[8] = m_right.z();
65 flattened[9] = m_bottom.x(); 65 flattened[9] = m_bottom.x();
66 flattened[10] = m_bottom.y(); 66 flattened[10] = m_bottom.y();
67 flattened[11] = m_bottom.z(); 67 flattened[11] = m_bottom.z();
68 } 68 }
69 69
70 } // namespace cc 70 } // namespace cc
OLDNEW
« cc/active_animation.h ('K') | « cc/layer_quad.h ('k') | cc/layer_quad_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698