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

Side by Side Diff: cc/CCLayerQuad.cpp

Issue 11122003: [cc] Rename all cc/ filenames to Chromium style (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
« no previous file with comments | « cc/CCLayerQuad.h ('k') | cc/CCLayerSorter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5
6 #include "config.h"
7
8 #if USE(ACCELERATED_COMPOSITING)
9
10 #include "CCLayerQuad.h"
11
12 namespace cc {
13
14 CCLayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q)
15 {
16 ASSERT(p != q);
17
18 FloatPoint tangent(p.y() - q.y(), q.x() - p.x());
19 float cross2 = p.x() * q.y() - q.x() * p.y();
20
21 set(tangent.x(), tangent.y(), cross2);
22 scale(1.0f / tangent.length());
23 }
24
25 CCLayerQuad::CCLayerQuad(const FloatQuad& quad)
26 {
27 // Create edges.
28 m_left = Edge(quad.p4(), quad.p1());
29 m_right = Edge(quad.p2(), quad.p3());
30 m_top = Edge(quad.p1(), quad.p2());
31 m_bottom = Edge(quad.p3(), quad.p4());
32
33 float sign = quad.isCounterclockwise() ? -1 : 1;
34 m_left.scale(sign);
35 m_right.scale(sign);
36 m_top.scale(sign);
37 m_bottom.scale(sign);
38 }
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
48 FloatQuad CCLayerQuad::floatQuad() const
49 {
50 return FloatQuad(m_left.intersect(m_top),
51 m_top.intersect(m_right),
52 m_right.intersect(m_bottom),
53 m_bottom.intersect(m_left));
54 }
55
56 void CCLayerQuad::toFloatArray(float flattened[12]) const
57 {
58 flattened[0] = m_left.x();
59 flattened[1] = m_left.y();
60 flattened[2] = m_left.z();
61 flattened[3] = m_top.x();
62 flattened[4] = m_top.y();
63 flattened[5] = m_top.z();
64 flattened[6] = m_right.x();
65 flattened[7] = m_right.y();
66 flattened[8] = m_right.z();
67 flattened[9] = m_bottom.x();
68 flattened[10] = m_bottom.y();
69 flattened[11] = m_bottom.z();
70 }
71
72 } // namespace cc
73
74 #endif // USE(ACCELERATED_COMPOSITING)
OLDNEW
« no previous file with comments | « cc/CCLayerQuad.h ('k') | cc/CCLayerSorter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698