From e8d85b06943aee3829dc82c6dc06d7475d29bbf4 Mon Sep 17 00:00:00 2001 From: Liav A Date: Fri, 28 May 2021 13:11:34 +0300 Subject: [PATCH] Kernel/Graphics: Remove unused overloaded write methods of Console If we happen to print a string, we could use a StringView instead. For now, let's remove them entirely. --- Kernel/Graphics/Console/Console.h | 2 -- .../Graphics/Console/FramebufferConsole.cpp | 8 ----- Kernel/Graphics/Console/FramebufferConsole.h | 2 -- Kernel/Graphics/Console/TextModeConsole.cpp | 33 +------------------ Kernel/Graphics/Console/TextModeConsole.h | 2 -- 5 files changed, 1 insertion(+), 46 deletions(-) diff --git a/Kernel/Graphics/Console/Console.h b/Kernel/Graphics/Console/Console.h index 448f1c7df62..67d7ef2407e 100644 --- a/Kernel/Graphics/Console/Console.h +++ b/Kernel/Graphics/Console/Console.h @@ -56,9 +56,7 @@ public: virtual void clear(size_t x, size_t y, size_t length) const = 0; virtual void write(size_t x, size_t y, char ch, Color background, Color foreground) const = 0; - virtual void write(size_t x, size_t y, String, Color background, Color foreground) const = 0; virtual void write(size_t x, size_t y, char ch) const = 0; - virtual void write(size_t x, size_t y, String) const = 0; virtual void write(char ch) const = 0; virtual ~Console() { } diff --git a/Kernel/Graphics/Console/FramebufferConsole.cpp b/Kernel/Graphics/Console/FramebufferConsole.cpp index 5c960913c9b..041e605ad0d 100644 --- a/Kernel/Graphics/Console/FramebufferConsole.cpp +++ b/Kernel/Graphics/Console/FramebufferConsole.cpp @@ -339,18 +339,10 @@ void FramebufferConsole::write(size_t x, size_t y, char ch, Color background, Co } } -void FramebufferConsole::write(size_t, size_t, String, Color, Color) const -{ - TODO(); -} void FramebufferConsole::write(size_t x, size_t y, char ch) const { write(x, y, ch, m_default_background_color, m_default_foreground_color); } -void FramebufferConsole::write(size_t, size_t, String) const -{ - TODO(); -} void FramebufferConsole::write(char ch) const { diff --git a/Kernel/Graphics/Console/FramebufferConsole.h b/Kernel/Graphics/Console/FramebufferConsole.h index 7e141cef9af..b1ec3b98dcd 100644 --- a/Kernel/Graphics/Console/FramebufferConsole.h +++ b/Kernel/Graphics/Console/FramebufferConsole.h @@ -33,9 +33,7 @@ public: virtual void clear(size_t x, size_t y, size_t length) const override; virtual void write(size_t x, size_t y, char ch, Color background, Color foreground) const override; - virtual void write(size_t x, size_t y, String cstring, Color background, Color foreground) const override; virtual void write(size_t x, size_t y, char ch) const override; - virtual void write(size_t x, size_t y, String) const override; virtual void write(char ch) const override; virtual void enable() override; diff --git a/Kernel/Graphics/Console/TextModeConsole.cpp b/Kernel/Graphics/Console/TextModeConsole.cpp index 847f899ffe1..68e0860f72b 100644 --- a/Kernel/Graphics/Console/TextModeConsole.cpp +++ b/Kernel/Graphics/Console/TextModeConsole.cpp @@ -132,22 +132,7 @@ void TextModeConsole::write(size_t x, size_t y, char ch) const m_y = 0; } } -void TextModeConsole::write(size_t x, size_t y, String cstring) const -{ - ScopedSpinLock lock(m_vga_lock); - auto* buf = (u16*)(m_current_vga_window + (x * 2) + (y * width() * 2)); - u16 color_mask = (m_default_foreground_color << 8) | (m_default_background_color << 12); - for (size_t index = 0; index < cstring.length(); index++) { - buf[index] = color_mask | cstring[index]; - } - m_x = x + cstring.length(); - if (m_x >= max_column()) { - m_x = 0; - m_y = y + 1; - if (m_y >= max_row()) - m_y = 0; - } -} + void TextModeConsole::write(size_t x, size_t y, char ch, Color background, Color foreground) const { ScopedSpinLock lock(m_vga_lock); @@ -161,22 +146,6 @@ void TextModeConsole::write(size_t x, size_t y, char ch, Color background, Color m_y = 0; } } -void TextModeConsole::write(size_t x, size_t y, String cstring, Color background, Color foreground) const -{ - ScopedSpinLock lock(m_vga_lock); - auto* buf = (u16*)(m_current_vga_window + (x * 2) + (y * width() * 2)); - u16 color_mask = foreground << 8 | background << 12; - for (size_t index = 0; index < cstring.length(); index++) { - buf[index] = color_mask | cstring[index]; - } - m_x = x + cstring.length(); - if (m_x >= max_column()) { - m_x = 0; - m_y = y + 1; - if (m_y >= max_row()) - m_y = 0; - } -} void TextModeConsole::clear_vga_row(u16 row) { diff --git a/Kernel/Graphics/Console/TextModeConsole.h b/Kernel/Graphics/Console/TextModeConsole.h index c465b63f396..7366f739875 100644 --- a/Kernel/Graphics/Console/TextModeConsole.h +++ b/Kernel/Graphics/Console/TextModeConsole.h @@ -26,9 +26,7 @@ public: virtual void show_cursor() override; virtual void clear(size_t x, size_t y, size_t length) const override; virtual void write(size_t x, size_t y, char ch) const override; - virtual void write(size_t x, size_t y, String cstring) const override; virtual void write(size_t x, size_t y, char ch, Color background, Color foreground) const override; - virtual void write(size_t x, size_t y, String, Color background, Color foreground) const override; virtual void write(char ch) const override; virtual void enable() override { }