Add clang-tidy. (#368)

This commit is contained in:
Arthur Sonzogni
2022-03-31 02:17:43 +02:00
committed by GitHub
parent 62fb6298be
commit aebde94352
80 changed files with 1958 additions and 1376 deletions

View File

@@ -21,27 +21,29 @@ Element vscroll_indicator(Element child) {
using NodeDecorator::NodeDecorator;
void ComputeRequirement() override {
Node::ComputeRequirement();
NodeDecorator::ComputeRequirement();
requirement_ = children_[0]->requirement();
requirement_.min_x++;
}
void SetBox(Box box) override {
Node::SetBox(box);
if (box_.x_min > box_.x_max)
NodeDecorator::SetBox(box);
if (box_.x_min > box_.x_max) {
box_.x_max--;
}
children_[0]->SetBox(box);
}
void Render(Screen& screen) final {
Node::Render(screen);
NodeDecorator::Render(screen);
const Box& stencil = screen.stencil;
int size_inner = box_.y_max - box_.y_min;
int size_outter = stencil.y_max - stencil.y_min + 1;
if (size_outter >= size_inner)
if (size_outter >= size_inner) {
return;
}
int size = 2 * size_outter * size_outter / size_inner;
size = std::max(size, 1);
@@ -56,7 +58,7 @@ Element vscroll_indicator(Element child) {
bool up = (start_y <= y_up) && (y_up <= start_y + size);
bool down = (start_y <= y_down) && (y_down <= start_y + size);
const char* c = up ? (down ? "" : "") : (down ? "" : " ");
const char* c = up ? (down ? "" : "") : (down ? "" : " "); // NOLINT
screen.PixelAt(x, y) = Pixel();
screen.PixelAt(x, y).character = c;
}