21 using NodeDecorator::NodeDecorator;
23 void ComputeRequirement()
override {
24 NodeDecorator::ComputeRequirement();
25 requirement_ = children_[0]->requirement();
29 void SetBox(
Box box)
override {
32 children_[0]->SetBox(box);
36 NodeDecorator::Render(screen);
40 const int size_inner = box_.
y_max - box_.y_min;
41 if (size_inner <= 0) {
44 const int size_outter = stencil.
y_max - stencil.
y_min + 1;
45 if (size_outter >= size_inner) {
49 int size = 2 * size_outter * size_outter / size_inner;
54 2 * (stencil.
y_min - box_.y_min) * size_outter / size_inner;
56 const int x = stencil.
x_max;
57 for (
int y = stencil.
y_min; y <= stencil.
y_max; ++y) {
58 const int y_up = 2 * y + 0;
59 const int y_down = 2 * y + 1;
60 const bool up = (start_y <= y_up) && (y_up <= start_y +
size);
61 const bool down = (start_y <= y_down) && (y_down <= start_y +
size);
63 const char* c = up ? (down ?
"┃" :
"╹") : (down ?
"╻" :
" ");
69 return std::make_shared<Impl>(std::move(child));