Browse Source

LibGfx: Adjust parameter order for Painter::draw_ui_text()

Let's put the rect first so it's the same as draw_text().
Andreas Kling 4 years ago
parent
commit
b7a25bfaac

+ 2 - 2
Userland/Libraries/LibGfx/Painter.cpp

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -1806,7 +1806,7 @@ void Painter::blit_tiled(const IntRect& dst_rect, const Gfx::Bitmap& bitmap, con
     }
 }
 
-void Gfx::Painter::draw_ui_text(const StringView& text, const Gfx::IntRect& rect, const Gfx::Font& font, Gfx::Color color)
+void Gfx::Painter::draw_ui_text(const Gfx::IntRect& rect, const StringView& text, const Gfx::Font& font, Gfx::Color color)
 {
     auto parse_ampersand_string = [](const StringView& raw_text, Optional<size_t>& underline_offset) -> String {
         if (raw_text.is_empty())

+ 2 - 2
Userland/Libraries/LibGfx/Painter.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -85,7 +85,7 @@ public:
     void draw_text(Function<void(const IntRect&, u32)>, const IntRect&, const StringView&, const Font&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None);
     void draw_text(Function<void(const IntRect&, u32)>, const IntRect&, const Utf8View&, const Font&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None);
     void draw_text(Function<void(const IntRect&, u32)>, const IntRect&, const Utf32View&, const Font&, TextAlignment = TextAlignment::TopLeft, TextElision = TextElision::None);
-    void draw_ui_text(const StringView&, const Gfx::IntRect&, const Gfx::Font&, Gfx::Color);
+    void draw_ui_text(const Gfx::IntRect&, const StringView&, const Gfx::Font&, Gfx::Color);
     void draw_glyph(const IntPoint&, u32, Color);
     void draw_glyph(const IntPoint&, u32, const Font&, Color);
     void draw_emoji(const IntPoint&, const Gfx::Bitmap&, const Font&);

+ 1 - 1
Userland/Services/WindowServer/WindowFrame.cpp

@@ -317,7 +317,7 @@ void WindowFrame::paint_menubar(Gfx::Painter& painter)
         if (paint_as_pressed || paint_as_hovered) {
             Gfx::StylePainter::paint_button(painter, menu.rect_in_window_menubar(), palette, Gfx::ButtonStyle::CoolBar, paint_as_pressed, paint_as_hovered);
         }
-        painter.draw_ui_text(menu.name(), text_rect, font, text_color);
+        painter.draw_ui_text(text_rect, menu.name(), font, text_color);
         return IterationDecision::Continue;
     });
 }