Clang fixes

This commit is contained in:
Michael Davidson 2023-12-22 20:35:37 +11:00
parent 64d34b2879
commit 447e3bdce7
No known key found for this signature in database
GPG key ID: B8D1A99712B8B0EB
10 changed files with 24 additions and 20 deletions

View file

@ -517,7 +517,7 @@ class Display : public PollingComponent {
* @param[in] x: x coordinate as the new local. Absolute to the displays underlying 0
* @param[in] y: y coordinate as the new local. Absolute to the displays underlying 0
*/
void set_local_coordinate(int x, int y) { this->local_coordinate_.push_back(Point(x, y)); };
void set_local_coordinate(int x, int y) { this->local_coordinate_.emplace_back(x, y); };
/** Changes the local coordinates to be to be (x_local + x_offset, y_local + y_offset)
* After calling a pixel drawn at (10, 20) would be drawn to the screen at

View file

@ -14,7 +14,7 @@ void DisplayRenderingPanel::dump_config(int indent_depth, int additional_level_d
ESP_LOGCONFIG(TAG, "%*sHas drawing lambda: %s", indent_depth, "", YESNO(this->lambda_ != nullptr));
}
const display::Rect DisplayRenderingPanel::measure_item(display::Display *display) {
display::Rect DisplayRenderingPanel::measure_item(display::Display *display) {
return display::Rect(0, 0, this->width_, this->width_);
}

View file

@ -1,5 +1,7 @@
#pragma once
#include <utility>
#include "esphome/components/graphical_layout/graphical_layout.h"
#include "esphome/components/font/font.h"
@ -14,13 +16,13 @@ using display_writer_t = std::function<void(display::Display &)>;
*/
class DisplayRenderingPanel : public LayoutItem {
public:
const display::Rect measure_item(display::Display *display);
void render(display::Display *display, display::Rect bounds);
void dump_config(int indent_depth, int additional_level_depth);
display::Rect measure_item(display::Display *display) override;
void render(display::Display *display, display::Rect bounds) override;
void dump_config(int indent_depth, int additional_level_depth) override;
void set_width(int width) { this->width_ = width; };
void set_height(int height) { this->height_ = height; };
void set_lambda(display_writer_t lambda) { this->lambda_ = lambda; };
void set_lambda(display_writer_t lambda) { this->lambda_ = std::move(lambda); };
protected:
int width_{0};

View file

@ -18,7 +18,7 @@ void HorizontalStack::dump_config(int indent_depth, int additional_level_depth)
}
}
const display::Rect HorizontalStack::measure_item(display::Display *display) {
display::Rect HorizontalStack::measure_item(display::Display *display) {
display::Rect rect(this->item_padding_, 0, 0, 0);
for (LayoutItem *child : this->children_) {

View file

@ -11,10 +11,10 @@ namespace graphical_layout {
*/
class HorizontalStack : public ContainerLayoutItem {
public:
const display::Rect measure_item(display::Display *display);
void render(display::Display *display, display::Rect bounds);
display::Rect measure_item(display::Display *display) override;
void render(display::Display *display, display::Rect bounds) override;
void dump_config(int indent_depth, int additional_level_depth) override;
void dump_config(int indent_depth, int additional_level_depth);
void set_item_padding(int item_padding) { this->item_padding_ = item_padding; };
protected:

View file

@ -15,7 +15,7 @@ class LayoutItem {
*
* param[in] display: Display that will be used for rendering. May be used to help with calculations
*/
virtual const display::Rect measure_item(display::Display *display) = 0;
virtual display::Rect measure_item(display::Display *display) = 0;
/** Perform the rendering of the item to the display
*

View file

@ -13,7 +13,7 @@ void TextPanel::dump_config(int indent_depth, int additional_level_depth) {
ESP_LOGCONFIG(TAG, "%*sText: %s", indent_depth, "", this->text_.c_str());
}
const display::Rect TextPanel::measure_item(display::Display *display) {
display::Rect TextPanel::measure_item(display::Display *display) {
int x1;
int y1;
int width;

View file

@ -1,5 +1,7 @@
#pragma once
#include <utility>
#include "esphome/components/graphical_layout/graphical_layout.h"
#include "esphome/components/font/font.h"
@ -12,12 +14,12 @@ const Color COLOR_OFF(0, 0, 0, 0);
/** The TextPanel is a UI item that renders a single line of text to a display */
class TextPanel : public LayoutItem {
public:
const display::Rect measure_item(display::Display *display);
void render(display::Display *display, display::Rect bounds);
void dump_config(int indent_depth, int additional_level_depth);
display::Rect measure_item(display::Display *display) override;
void render(display::Display *display, display::Rect bounds) override;
void dump_config(int indent_depth, int additional_level_depth) override;
void set_item_padding(int item_padding) { this->item_padding_ = item_padding; };
void set_text(std::string text) { this->text_ = text; };
void set_text(std::string text) { this->text_ = std::move(text); };
void set_font(display::BaseFont *font) { this->font_ = font; };
void set_foreground_color(Color foreground_color) { this->foreground_color_ = foreground_color; };
void set_background_color(Color background_color) { this->background_color_ = background_color; };

View file

@ -18,7 +18,7 @@ void VerticalStack::dump_config(int indent_depth, int additional_level_depth) {
}
}
const display::Rect VerticalStack::measure_item(display::Display *display) {
display::Rect VerticalStack::measure_item(display::Display *display) {
display::Rect rect(0, this->item_padding_, 0, 0);
for (LayoutItem *child : this->children_) {

View file

@ -10,10 +10,10 @@ namespace graphical_layout {
*/
class VerticalStack : public ContainerLayoutItem {
public:
const display::Rect measure_item(display::Display *display);
void render(display::Display *display, display::Rect bounds);
display::Rect measure_item(display::Display *display) override;
void render(display::Display *display, display::Rect bounds) override;
void dump_config(int indent_depth, int additional_level_depth) override;
void dump_config(int indent_depth, int additional_level_depth);
void set_item_padding(int item_padding) { this->item_padding_ = item_padding; };
protected: