Cleanup entity API.

This commit is contained in:
Chinmay Garde
2021-11-18 12:47:27 -08:00
committed by Dan Field
parent 75daec6e7b
commit 14a3b5e187
5 changed files with 2 additions and 41 deletions

View File

@@ -94,7 +94,7 @@ TEST_F(AiksTest, CanRenderCurvedStrokes) {
paint.stroke_width = 25.0;
paint.style = Paint::Style::kStroke;
canvas.DrawPath(PathBuilder{}.AddCircle({500, 500}, 250).CreatePath(), paint);
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
// ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}
} // namespace testing

View File

@@ -80,7 +80,6 @@ void Canvas::ClipPath(Path path) {
Entity entity;
entity.SetTransformation(GetCurrentTransformation());
entity.SetPath(std::move(path));
entity.SetIsClip(true);
GetCurrentPass().PushEntity(std::move(entity));
}

View File

@@ -18,22 +18,6 @@ void Entity::SetTransformation(const Matrix& transformation) {
transformation_ = transformation;
}
const Color& Entity::GetStrokeColor() const {
return stroke_color_;
}
void Entity::SetStrokeColor(const Color& strokeColor) {
stroke_color_ = strokeColor;
}
double Entity::GetStrokeSize() const {
return stroke_size_;
}
void Entity::SetStrokeSize(double strokeSize) {
stroke_size_ = std::max(strokeSize, 0.0);
}
const Path& Entity::GetPath() const {
return path_;
}
@@ -42,14 +26,6 @@ void Entity::SetPath(Path path) {
path_ = std::move(path);
}
void Entity::SetIsClip(bool is_clip) {
is_clip_ = is_clip;
}
bool Entity::IsClip() const {
return is_clip_;
}
void Entity::SetContents(std::shared_ptr<Contents> contents) {
contents_ = std::move(contents);
}

View File

@@ -23,22 +23,10 @@ class Entity {
void SetTransformation(const Matrix& transformation);
const Color& GetStrokeColor() const;
void SetStrokeColor(const Color& strokeColor);
double GetStrokeSize() const;
void SetStrokeSize(double strokeSize);
const Path& GetPath() const;
void SetPath(Path path);
void SetIsClip(bool is_clip);
bool IsClip() const;
void SetContents(std::shared_ptr<Contents> contents);
const std::shared_ptr<Contents>& GetContents() const;
@@ -47,9 +35,6 @@ class Entity {
Matrix transformation_;
std::shared_ptr<Contents> contents_;
Path path_;
Color stroke_color_;
double stroke_size_ = 1.0;
bool is_clip_ = false;
};
} // namespace impeller

View File

@@ -17,6 +17,7 @@ in vec2 vertex_normal;
out vec4 stroke_color;
void main() {
// Push one vertex by the half stroke size along the normal vector.
vec2 offset = vertex_normal * vec2(stroke_info.size * 0.5);
gl_Position = frame_info.mvp * vec4(vertex_position + offset, 0.0, 1.0);
stroke_color = stroke_info.color;