Skip to content

Commit

Permalink
WIP Add test for clip rendering.
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde authored and dnfield committed Apr 27, 2022
1 parent ede7645 commit 9ce9a81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions impeller/aiks/aiks_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,15 @@ TEST_F(AiksTest, CanRenderCurvedStrokes) {
// ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

TEST_F(AiksTest, CanRenderClips) {
Canvas canvas;
Paint paint;
paint.color = Color::Fuchsia();
canvas.ClipPath(
PathBuilder{}.AddRect(Rect::MakeXYWH(0, 0, 100, 100)).CreatePath());
canvas.DrawPath(PathBuilder{}.AddCircle({100, 100}, 50).CreatePath(), paint);
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

} // namespace testing
} // namespace impeller
5 changes: 1 addition & 4 deletions impeller/aiks/canvas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ void Canvas::SaveLayer(const Paint& paint, std::optional<Rect> bounds) {
}

void Canvas::ClipPath(Path path) {
Entity entity;
entity.SetTransformation(GetCurrentTransformation());
entity.SetPath(std::move(path));
GetCurrentPass().PushEntity(std::move(entity));
passes_.push_back({});
}

void Canvas::DrawShadow(Path path, Color color, Scalar elevation) {}
Expand Down
3 changes: 3 additions & 0 deletions impeller/renderer/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class Context;
class DeviceBuffer;
class Texture;

//------------------------------------------------------------------------------
/// @brief An object that allocates device memory.
///
class Allocator {
public:
virtual ~Allocator();
Expand Down

0 comments on commit 9ce9a81

Please sign in to comment.