WIP Add test for clip rendering.

This commit is contained in:
Chinmay Garde
2021-11-18 15:26:47 -08:00
committed by Dan Field
parent 14a3b5e187
commit b0fbe2252b
3 changed files with 14 additions and 4 deletions

View File

@@ -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

View File

@@ -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) {}

View File

@@ -47,6 +47,9 @@ class Context;
class DeviceBuffer;
class Texture;
//------------------------------------------------------------------------------
/// @brief An object that allocates device memory.
///
class Allocator {
public:
virtual ~Allocator();