Skip to content

Commit 08f00cd

Browse files
chinmaygardednfield
authored andcommitted
Move entity shaders to their own directory.
1 parent 28af36b commit 08f00cd

File tree

9 files changed

+35
-24
lines changed

9 files changed

+35
-24
lines changed

impeller/entity/BUILD.gn

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ impeller_shaders("entity_shaders") {
88
name = "entity"
99

1010
shaders = [
11-
"gradient_fill.frag",
12-
"gradient_fill.vert",
13-
"solid_fill.frag",
14-
"solid_fill.vert",
11+
"shaders/gradient_fill.frag",
12+
"shaders/gradient_fill.vert",
13+
"shaders/solid_fill.frag",
14+
"shaders/solid_fill.vert",
1515
]
1616
}
1717

impeller/geometry/path.cc

+13-12
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,26 @@ Path& Path::AddCubicComponent(Point p1, Point cp1, Point cp2, Point p2) {
3232
return *this;
3333
}
3434

35-
void Path::EnumerateComponents(Applier<LinearPathComponent> linearApplier,
36-
Applier<QuadraticPathComponent> quadApplier,
37-
Applier<CubicPathComponent> cubicApplier) const {
35+
void Path::EnumerateComponents(
36+
Applier<LinearPathComponent> linear_applier,
37+
Applier<QuadraticPathComponent> quad_applier,
38+
Applier<CubicPathComponent> cubic_applier) const {
3839
size_t currentIndex = 0;
3940
for (const auto& component : components_) {
4041
switch (component.type) {
4142
case ComponentType::kLinear:
42-
if (linearApplier) {
43-
linearApplier(currentIndex, linears_[component.index]);
43+
if (linear_applier) {
44+
linear_applier(currentIndex, linears_[component.index]);
4445
}
4546
break;
4647
case ComponentType::kQuadratic:
47-
if (quadApplier) {
48-
quadApplier(currentIndex, quads_[component.index]);
48+
if (quad_applier) {
49+
quad_applier(currentIndex, quads_[component.index]);
4950
}
5051
break;
5152
case ComponentType::kCubic:
52-
if (cubicApplier) {
53-
cubicApplier(currentIndex, cubics_[component.index]);
53+
if (cubic_applier) {
54+
cubic_applier(currentIndex, cubics_[component.index]);
5455
}
5556
break;
5657
}
@@ -155,15 +156,15 @@ std::vector<Point> Path::CreatePolyline(
155156
for (const auto& component : components_) {
156157
switch (component.type) {
157158
case ComponentType::kLinear:
158-
AddPoints(points, linears_[component.index].SubdivideAdaptively());
159+
AddPoints(points, linears_[component.index].CreatePolyline());
159160
break;
160161
case ComponentType::kQuadratic:
161162
AddPoints(points,
162-
quads_[component.index].SubdivideAdaptively(approximation));
163+
quads_[component.index].CreatePolyline(approximation));
163164
break;
164165
case ComponentType::kCubic:
165166
AddPoints(points,
166-
cubics_[component.index].SubdivideAdaptively(approximation));
167+
cubics_[component.index].CreatePolyline(approximation));
167168
break;
168169
}
169170
}

impeller/geometry/path.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@
77
#include <functional>
88
#include <vector>
99

10-
#include "path_component.h"
10+
#include "impeller/geometry/path_component.h"
1111

1212
namespace impeller {
1313

14+
//------------------------------------------------------------------------------
15+
/// @brief Paths are lightweight objects that describe a collection of
16+
/// linear, quadratic, or cubic segments.
17+
///
18+
/// All shapes supported by Impeller are paths either directly or
19+
/// via approximation (in the case of circles).
20+
///
21+
/// Creating paths that describe complex shapes is usually done by a
22+
/// path builder.
23+
///
1424
class Path {
1525
public:
1626
enum class ComponentType {

impeller/geometry/path_component.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Point LinearPathComponent::Solve(Scalar time) const {
6363
};
6464
}
6565

66-
std::vector<Point> LinearPathComponent::SubdivideAdaptively() const {
66+
std::vector<Point> LinearPathComponent::CreatePolyline() const {
6767
return {p1, p2};
6868
}
6969

@@ -85,10 +85,10 @@ Point QuadraticPathComponent::SolveDerivative(Scalar time) const {
8585
};
8686
}
8787

88-
std::vector<Point> QuadraticPathComponent::SubdivideAdaptively(
88+
std::vector<Point> QuadraticPathComponent::CreatePolyline(
8989
const SmoothingApproximation& approximation) const {
9090
CubicPathComponent elevated(*this);
91-
return elevated.SubdivideAdaptively(approximation);
91+
return elevated.CreatePolyline(approximation);
9292
}
9393

9494
std::vector<Point> QuadraticPathComponent::Extrema() const {
@@ -336,7 +336,7 @@ static void CubicPathSmoothenRecursive(const SmoothingApproximation& approx,
336336
CubicPathSmoothenRecursive(approx, points, p1234, p234, p34, p4, level + 1);
337337
}
338338

339-
std::vector<Point> CubicPathComponent::SubdivideAdaptively(
339+
std::vector<Point> CubicPathComponent::CreatePolyline(
340340
const SmoothingApproximation& approximation) const {
341341
std::vector<Point> points;
342342
points.emplace_back(p1);

impeller/geometry/path_component.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct LinearPathComponent {
4141

4242
Point Solve(Scalar time) const;
4343

44-
std::vector<Point> SubdivideAdaptively() const;
44+
std::vector<Point> CreatePolyline() const;
4545

4646
std::vector<Point> Extrema() const;
4747

@@ -64,7 +64,7 @@ struct QuadraticPathComponent {
6464

6565
Point SolveDerivative(Scalar time) const;
6666

67-
std::vector<Point> SubdivideAdaptively(
67+
std::vector<Point> CreatePolyline(
6868
const SmoothingApproximation& approximation) const;
6969

7070
std::vector<Point> Extrema() const;
@@ -95,7 +95,7 @@ struct CubicPathComponent {
9595

9696
Point SolveDerivative(Scalar time) const;
9797

98-
std::vector<Point> SubdivideAdaptively(
98+
std::vector<Point> CreatePolyline(
9999
const SmoothingApproximation& approximation) const;
100100

101101
std::vector<Point> Extrema() const;

0 commit comments

Comments
 (0)