diff options
Diffstat (limited to 'scene')
| -rw-r--r-- | scene/2d/sprite.cpp | 4 | ||||
| -rw-r--r-- | scene/gui/rich_text_label.cpp | 14 |
2 files changed, 7 insertions, 11 deletions
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 796969be1e..0dd02a982c 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -73,8 +73,8 @@ void Sprite::_get_rects(Rect2 &r_src_rect, Rect2 &r_dst_rect, bool &r_filter_cli s = s / Size2(hframes, vframes); r_src_rect.size = s; - r_src_rect.position.x += float(frame % hframes) * s.x; - r_src_rect.position.y += float(frame / hframes) * s.y; + r_src_rect.position.x = float(frame % hframes) * s.x; + r_src_rect.position.y = float(frame / hframes) * s.y; } Point2 ofs = offset; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index a92c3c326d..5bc5d8e690 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -247,6 +247,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & int rchar = 0; int lh = 0; bool line_is_blank = true; + int fh = 0; while (it) { @@ -262,14 +263,9 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & const CharType *c = text->text.c_str(); const CharType *cf = c; - int fh = font->get_height(); int ascent = font->get_ascent(); int descent = font->get_descent(); - line_ascent = MAX(line_ascent, ascent); - line_descent = MAX(line_descent, descent); - fh = MAX(fh, line_ascent + line_descent); // various fonts! - Color color; bool underline = false; @@ -317,12 +313,12 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & end++; } + CHECK_HEIGHT(fh); ENSURE_WIDTH(w); - if (p_mode == PROCESS_CACHE) { - line_ascent = ascent; - line_descent = descent; - } + line_ascent = MAX(line_ascent, ascent); + line_descent = MAX(line_descent, descent); + fh = line_ascent + line_descent; if (end && c[end - 1] == ' ') { if (p_mode == PROCESS_CACHE) { |