Skip to content

Commit

Permalink
Cleanup entity API.
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent ac10b79 commit ede7645
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 41 deletions.
2 changes: 1 addition & 1 deletion impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion impeller/aiks/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
24 changes: 0 additions & 24 deletions impeller/entity/entity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
}
Expand All @@ -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);
}
Expand Down
15 changes: 0 additions & 15 deletions impeller/entity/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
1 change: 1 addition & 0 deletions impeller/entity/shaders/solid_stroke.vert
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ede7645

Please sign in to comment.