Move entity shaders to their own directory.
This commit is contained in:
@@ -8,10 +8,10 @@ impeller_shaders("entity_shaders") {
|
||||
name = "entity"
|
||||
|
||||
shaders = [
|
||||
"gradient_fill.frag",
|
||||
"gradient_fill.vert",
|
||||
"solid_fill.frag",
|
||||
"solid_fill.vert",
|
||||
"shaders/gradient_fill.frag",
|
||||
"shaders/gradient_fill.vert",
|
||||
"shaders/solid_fill.frag",
|
||||
"shaders/solid_fill.vert",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -32,25 +32,26 @@ Path& Path::AddCubicComponent(Point p1, Point cp1, Point cp2, Point p2) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Path::EnumerateComponents(Applier<LinearPathComponent> linearApplier,
|
||||
Applier<QuadraticPathComponent> quadApplier,
|
||||
Applier<CubicPathComponent> cubicApplier) const {
|
||||
void Path::EnumerateComponents(
|
||||
Applier<LinearPathComponent> linear_applier,
|
||||
Applier<QuadraticPathComponent> quad_applier,
|
||||
Applier<CubicPathComponent> cubic_applier) const {
|
||||
size_t currentIndex = 0;
|
||||
for (const auto& component : components_) {
|
||||
switch (component.type) {
|
||||
case ComponentType::kLinear:
|
||||
if (linearApplier) {
|
||||
linearApplier(currentIndex, linears_[component.index]);
|
||||
if (linear_applier) {
|
||||
linear_applier(currentIndex, linears_[component.index]);
|
||||
}
|
||||
break;
|
||||
case ComponentType::kQuadratic:
|
||||
if (quadApplier) {
|
||||
quadApplier(currentIndex, quads_[component.index]);
|
||||
if (quad_applier) {
|
||||
quad_applier(currentIndex, quads_[component.index]);
|
||||
}
|
||||
break;
|
||||
case ComponentType::kCubic:
|
||||
if (cubicApplier) {
|
||||
cubicApplier(currentIndex, cubics_[component.index]);
|
||||
if (cubic_applier) {
|
||||
cubic_applier(currentIndex, cubics_[component.index]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -155,15 +156,15 @@ std::vector<Point> Path::CreatePolyline(
|
||||
for (const auto& component : components_) {
|
||||
switch (component.type) {
|
||||
case ComponentType::kLinear:
|
||||
AddPoints(points, linears_[component.index].SubdivideAdaptively());
|
||||
AddPoints(points, linears_[component.index].CreatePolyline());
|
||||
break;
|
||||
case ComponentType::kQuadratic:
|
||||
AddPoints(points,
|
||||
quads_[component.index].SubdivideAdaptively(approximation));
|
||||
quads_[component.index].CreatePolyline(approximation));
|
||||
break;
|
||||
case ComponentType::kCubic:
|
||||
AddPoints(points,
|
||||
cubics_[component.index].SubdivideAdaptively(approximation));
|
||||
cubics_[component.index].CreatePolyline(approximation));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,20 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#include "path_component.h"
|
||||
#include "impeller/geometry/path_component.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief Paths are lightweight objects that describe a collection of
|
||||
/// linear, quadratic, or cubic segments.
|
||||
///
|
||||
/// All shapes supported by Impeller are paths either directly or
|
||||
/// via approximation (in the case of circles).
|
||||
///
|
||||
/// Creating paths that describe complex shapes is usually done by a
|
||||
/// path builder.
|
||||
///
|
||||
class Path {
|
||||
public:
|
||||
enum class ComponentType {
|
||||
|
||||
@@ -63,7 +63,7 @@ Point LinearPathComponent::Solve(Scalar time) const {
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<Point> LinearPathComponent::SubdivideAdaptively() const {
|
||||
std::vector<Point> LinearPathComponent::CreatePolyline() const {
|
||||
return {p1, p2};
|
||||
}
|
||||
|
||||
@@ -85,10 +85,10 @@ Point QuadraticPathComponent::SolveDerivative(Scalar time) const {
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<Point> QuadraticPathComponent::SubdivideAdaptively(
|
||||
std::vector<Point> QuadraticPathComponent::CreatePolyline(
|
||||
const SmoothingApproximation& approximation) const {
|
||||
CubicPathComponent elevated(*this);
|
||||
return elevated.SubdivideAdaptively(approximation);
|
||||
return elevated.CreatePolyline(approximation);
|
||||
}
|
||||
|
||||
std::vector<Point> QuadraticPathComponent::Extrema() const {
|
||||
@@ -336,7 +336,7 @@ static void CubicPathSmoothenRecursive(const SmoothingApproximation& approx,
|
||||
CubicPathSmoothenRecursive(approx, points, p1234, p234, p34, p4, level + 1);
|
||||
}
|
||||
|
||||
std::vector<Point> CubicPathComponent::SubdivideAdaptively(
|
||||
std::vector<Point> CubicPathComponent::CreatePolyline(
|
||||
const SmoothingApproximation& approximation) const {
|
||||
std::vector<Point> points;
|
||||
points.emplace_back(p1);
|
||||
|
||||
@@ -41,7 +41,7 @@ struct LinearPathComponent {
|
||||
|
||||
Point Solve(Scalar time) const;
|
||||
|
||||
std::vector<Point> SubdivideAdaptively() const;
|
||||
std::vector<Point> CreatePolyline() const;
|
||||
|
||||
std::vector<Point> Extrema() const;
|
||||
|
||||
@@ -64,7 +64,7 @@ struct QuadraticPathComponent {
|
||||
|
||||
Point SolveDerivative(Scalar time) const;
|
||||
|
||||
std::vector<Point> SubdivideAdaptively(
|
||||
std::vector<Point> CreatePolyline(
|
||||
const SmoothingApproximation& approximation) const;
|
||||
|
||||
std::vector<Point> Extrema() const;
|
||||
@@ -95,7 +95,7 @@ struct CubicPathComponent {
|
||||
|
||||
Point SolveDerivative(Scalar time) const;
|
||||
|
||||
std::vector<Point> SubdivideAdaptively(
|
||||
std::vector<Point> CreatePolyline(
|
||||
const SmoothingApproximation& approximation) const;
|
||||
|
||||
std::vector<Point> Extrema() const;
|
||||
|
||||
Reference in New Issue
Block a user