mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
Merge pull request #104386 from Repiteo/core/cpp-math
Core: Replace C math headers with C++ equivalents
This commit is contained in:
commit
3947cbe3b2
101 changed files with 414 additions and 498 deletions
|
|
@ -630,8 +630,8 @@ float RichTextLabel::_shape_line(ItemFrame *p_frame, int p_line, const Ref<Font>
|
|||
t_char_count += cell_ch;
|
||||
remaining_characters -= cell_ch;
|
||||
|
||||
table->columns[column].min_width = MAX(table->columns[column].min_width, frame->lines[i].indent + ceil(frame->lines[i].text_buf->get_size().x));
|
||||
table->columns[column].max_width = MAX(table->columns[column].max_width, frame->lines[i].indent + ceil(frame->lines[i].text_buf->get_non_wrapped_size().x));
|
||||
table->columns[column].min_width = MAX(table->columns[column].min_width, frame->lines[i].indent + std::ceil(frame->lines[i].text_buf->get_size().x));
|
||||
table->columns[column].max_width = MAX(table->columns[column].max_width, frame->lines[i].indent + std::ceil(frame->lines[i].text_buf->get_non_wrapped_size().x));
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
|
@ -755,8 +755,8 @@ void RichTextLabel::_set_table_size(ItemTable *p_table, int p_available_width) {
|
|||
MutexLock sub_lock(frame->lines[i].text_buf->get_mutex());
|
||||
|
||||
frame->lines[i].text_buf->set_width(p_table->columns[column].width);
|
||||
p_table->columns[column].width = MAX(p_table->columns[column].width, ceil(frame->lines[i].text_buf->get_size().x));
|
||||
p_table->columns[column].width_with_padding = MAX(p_table->columns[column].width_with_padding, ceil(frame->lines[i].text_buf->get_size().x + frame->padding.position.x + frame->padding.size.x));
|
||||
p_table->columns[column].width = MAX(p_table->columns[column].width, std::ceil(frame->lines[i].text_buf->get_size().x));
|
||||
p_table->columns[column].width_with_padding = MAX(p_table->columns[column].width_with_padding, std::ceil(frame->lines[i].text_buf->get_size().x + frame->padding.position.x + frame->padding.size.x));
|
||||
|
||||
frame->lines[i].offset.y = prev_h;
|
||||
|
||||
|
|
@ -2404,9 +2404,9 @@ void RichTextLabel::_notification(int p_what) {
|
|||
bool right_to_left = is_layout_rtl();
|
||||
double r = loaded.load();
|
||||
int mp = theme_cache.progress_fg_style->get_minimum_size().width;
|
||||
int p = round(r * (p_size.width - mp));
|
||||
int p = std::round(r * (p_size.width - mp));
|
||||
if (right_to_left) {
|
||||
int p_remaining = round((1.0 - r) * (p_size.width - mp));
|
||||
int p_remaining = std::round((1.0 - r) * (p_size.width - mp));
|
||||
draw_style_box(theme_cache.progress_fg_style, Rect2(p_pos + Point2(p_remaining, 0), Size2(p + theme_cache.progress_fg_style->get_minimum_size().width, p_size.height)));
|
||||
} else {
|
||||
draw_style_box(theme_cache.progress_fg_style, Rect2(p_pos, Size2(p + theme_cache.progress_fg_style->get_minimum_size().width, p_size.height)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue