WIP Add test for clip rendering.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -47,6 +47,9 @@ class Context;
|
||||
class DeviceBuffer;
|
||||
class Texture;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// @brief An object that allocates device memory.
|
||||
///
|
||||
class Allocator {
|
||||
public:
|
||||
virtual ~Allocator();
|
||||
|
||||
Reference in New Issue
Block a user