Skip to content

Commit 0a09305

Browse files
committed
Improve demo app
1 parent 7b8510a commit 0a09305

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

demo/common/app.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ App::App(const std::shared_ptr<Device> &device,
1818
// Set up a canvas.
1919
canvas_ = std::make_shared<Canvas>(canvas_size, device, queue, RenderLevel::D3d9);
2020

21-
// TEST: View box clipping.
21+
// Test: view box clipping.
2222
if (true) {
2323
Path2d path;
2424
path.add_rect(RectF(Vec2F(400, 400), canvas_size.to_f32() + Vec2F(100)));
@@ -27,14 +27,14 @@ App::App(const std::shared_ptr<Device> &device,
2727
canvas_->fill_path(path, FillRule::Winding);
2828
}
2929

30-
// TEST: Clip path.
30+
// Test: clip path.
3131
if (true) {
3232
Path2d path;
3333
path.add_circle(Vec2F(180.0, 180.0), 180);
3434
canvas_->clip_path(path, FillRule::Winding);
3535
}
3636

37-
// TEST: Draw image.
37+
// Test: draw image.
3838
if (true) {
3939
auto image_buffer = ImageBuffer::from_memory(img_input, false);
4040
if (image_buffer) {
@@ -44,7 +44,7 @@ App::App(const std::shared_ptr<Device> &device,
4444
}
4545
}
4646

47-
// TEST: Minimal path.
47+
// Test: minimal path.
4848
if (true) {
4949
Path2d path;
5050
path.move_to(260.0, 260.0);
@@ -53,9 +53,9 @@ App::App(const std::shared_ptr<Device> &device,
5353
path.line_to(260.0, 460.0);
5454
path.close_path();
5555

56-
// TEST: Shadow/Blur.
56+
// Test: shadow/blur.
5757
if (false) {
58-
canvas_->set_shadow_color(ColorU::red());
58+
canvas_->set_shadow_color(ColorU::white());
5959
canvas_->set_shadow_blur(16);
6060
}
6161

@@ -72,7 +72,7 @@ App::App(const std::shared_ptr<Device> &device,
7272
canvas_->stroke_path(path);
7373
}
7474

75-
// TEST: Render a target pattern.
75+
// Test: draw a target pattern.
7676
if (true) {
7777
auto render_target_size = Vec2I(400, 300);
7878
auto render_target_desc = RenderTargetDesc{render_target_size, "sub render target"};
@@ -89,19 +89,21 @@ App::App(const std::shared_ptr<Device> &device,
8989

9090
canvas_->get_scene()->pop_render_target();
9191

92-
canvas_->draw_render_target(render_target_id, {{}, render_target_size.to_f32()});
92+
auto pos = Vec2F(100, 50);
93+
94+
canvas_->draw_render_target(render_target_id, {pos, pos + render_target_size.to_f32()});
9395
}
9496

9597
scene_0_ = canvas_->get_scene();
9698

97-
// TEST: Append an SVG scene.
99+
// Test: append an SVG scene.
98100
if (true) {
99101
auto svg_scene = SvgScene(std::string(svg_input.begin(), svg_input.end()), *canvas_);
100102

101-
// TEST: Replace with a scene.
103+
// Test: replace with a scene.
102104
scene_1_ = svg_scene.get_scene();
103105

104-
// TEST: Append a scene.
106+
// Test: append a scene.
105107
// canvas_->get_scene()->append_scene(*scene_1, Transform2::from_scale({1.0, 1.0}));
106108
}
107109

0 commit comments

Comments
 (0)