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

Side by Side Diff: cc/resources/layer_quad.h

Issue 1144693002: cc: Move files out of cc/resources/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resources: android Created 5 years, 7 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
« no previous file with comments | « cc/resources/largest_display_item.cc ('k') | cc/resources/layer_quad.cc » ('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 #ifndef CC_RESOURCES_LAYER_QUAD_H_
7 #define CC_RESOURCES_LAYER_QUAD_H_
8
9 #include "base/basictypes.h"
10 #include "cc/base/cc_export.h"
11 #include "ui/gfx/geometry/point_f.h"
12
13 namespace gfx {
14 class QuadF;
15 }
16
17 static const float kAntiAliasingInflateDistance = 0.5f;
18
19 namespace cc {
20
21 class CC_EXPORT LayerQuad {
22 public:
23 class CC_EXPORT Edge {
24 public:
25 Edge() : x_(0), y_(0), z_(0), degenerate_(false) {}
26 Edge(const gfx::PointF& p, const gfx::PointF& q);
27
28 float x() const { return x_; }
29 float y() const { return y_; }
30 float z() const { return z_; }
31
32 void set_x(float x) { x_ = x; }
33 void set_y(float y) { y_ = y; }
34 void set_z(float z) { z_ = z; }
35 void set(float x, float y, float z) {
36 x_ = x;
37 y_ = y;
38 z_ = z;
39 }
40
41 void move_x(float dx) { x_ += dx; }
42 void move_y(float dy) { y_ += dy; }
43 void move_z(float dz) { z_ += dz; }
44 void move(float dx, float dy, float dz) {
45 x_ += dx;
46 y_ += dy;
47 z_ += dz;
48 }
49
50 void scale_x(float sx) { x_ *= sx; }
51 void scale_y(float sy) { y_ *= sy; }
52 void scale_z(float sz) { z_ *= sz; }
53 void scale(float sx, float sy, float sz) {
54 x_ *= sx;
55 y_ *= sy;
56 z_ *= sz;
57 }
58 void scale(float s) { scale(s, s, s); }
59
60 bool degenerate() const { return degenerate_; }
61
62 gfx::PointF Intersect(const Edge& e) const;
63
64 private:
65 float x_;
66 float y_;
67 float z_;
68 bool degenerate_;
69 };
70
71 LayerQuad(const Edge& left,
72 const Edge& top,
73 const Edge& right,
74 const Edge& bottom);
75 explicit LayerQuad(const gfx::QuadF& quad);
76
77 Edge left() const { return left_; }
78 Edge top() const { return top_; }
79 Edge right() const { return right_; }
80 Edge bottom() const { return bottom_; }
81
82 void InflateX(float dx) {
83 left_.move_z(dx);
84 right_.move_z(dx);
85 }
86 void InflateY(float dy) {
87 top_.move_z(dy);
88 bottom_.move_z(dy);
89 }
90 void Inflate(float d) {
91 InflateX(d);
92 InflateY(d);
93 }
94 void InflateAntiAliasingDistance() {
95 Inflate(kAntiAliasingInflateDistance);
96 }
97
98 gfx::QuadF ToQuadF() const;
99
100 void ToFloatArray(float flattened[12]) const;
101
102 private:
103 Edge left_;
104 Edge top_;
105 Edge right_;
106 Edge bottom_;
107
108 DISALLOW_COPY_AND_ASSIGN(LayerQuad);
109 };
110
111 } // namespace cc
112
113 #endif // CC_RESOURCES_LAYER_QUAD_H_
OLDNEW
« no previous file with comments | « cc/resources/largest_display_item.cc ('k') | cc/resources/layer_quad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698