Skip to content

Commit 9ce9a81

Browse files
chinmaygardednfield
authored andcommitted
WIP Add test for clip rendering.
1 parent ede7645 commit 9ce9a81

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

impeller/aiks/aiks_unittests.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,15 @@ TEST_F(AiksTest, CanRenderCurvedStrokes) {
9797
// ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
9898
}
9999

100+
TEST_F(AiksTest, CanRenderClips) {
101+
Canvas canvas;
102+
Paint paint;
103+
paint.color = Color::Fuchsia();
104+
canvas.ClipPath(
105+
PathBuilder{}.AddRect(Rect::MakeXYWH(0, 0, 100, 100)).CreatePath());
106+
canvas.DrawPath(PathBuilder{}.AddCircle({100, 100}, 50).CreatePath(), paint);
107+
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
108+
}
109+
100110
} // namespace testing
101111
} // namespace impeller

impeller/aiks/canvas.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,7 @@ void Canvas::SaveLayer(const Paint& paint, std::optional<Rect> bounds) {
7777
}
7878

7979
void Canvas::ClipPath(Path path) {
80-
Entity entity;
81-
entity.SetTransformation(GetCurrentTransformation());
82-
entity.SetPath(std::move(path));
83-
GetCurrentPass().PushEntity(std::move(entity));
80+
passes_.push_back({});
8481
}
8582

8683
void Canvas::DrawShadow(Path path, Color color, Scalar elevation) {}

impeller/renderer/allocator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class Context;
4747
class DeviceBuffer;
4848
class Texture;
4949

50+
//------------------------------------------------------------------------------
51+
/// @brief An object that allocates device memory.
52+
///
5053
class Allocator {
5154
public:
5255
virtual ~Allocator();

0 commit comments

Comments
 (0)