LibGUI: Remove fill_color from texture copy API
Nothing was using this and it just overcomplicated everything
This commit is contained in:
parent
f79db874bf
commit
a912a4dc67
|
@ -93,7 +93,7 @@ namespace LibGUI
|
|||
draw_character(text[i], font, tl_x + (int32_t)(i * font.width()), tl_y, color);
|
||||
}
|
||||
|
||||
void Texture::shift_vertical(int32_t amount, uint32_t fill_color)
|
||||
void Texture::shift_vertical(int32_t amount)
|
||||
{
|
||||
const uint32_t amount_abs = BAN::Math::abs(amount);
|
||||
if (amount_abs == 0 || amount_abs >= height())
|
||||
|
@ -102,15 +102,9 @@ namespace LibGUI
|
|||
uint32_t* dst = (amount > 0) ? m_pixels.data() + width() * amount_abs : m_pixels.data();
|
||||
uint32_t* src = (amount < 0) ? m_pixels.data() + width() * amount_abs : m_pixels.data();
|
||||
memmove(dst, src, width() * (height() - amount_abs) * 4);
|
||||
|
||||
const uint32_t y_lo = (amount < 0) ? height() - amount_abs : 0;
|
||||
const uint32_t y_hi = (amount < 0) ? height() : amount_abs;
|
||||
for (uint32_t y = y_lo; y < y_hi; y++)
|
||||
for (uint32_t x = 0; x < width(); x++)
|
||||
set_pixel(x, y, fill_color);
|
||||
}
|
||||
|
||||
void Texture::copy_horizontal_slice(int32_t dst_y, int32_t src_y, uint32_t uamount, uint32_t fill_color)
|
||||
void Texture::copy_horizontal_slice(int32_t dst_y, int32_t src_y, uint32_t uamount)
|
||||
{
|
||||
int32_t amount = uamount;
|
||||
if (dst_y < 0)
|
||||
|
@ -134,18 +128,10 @@ namespace LibGUI
|
|||
copy_amount * width() * 4
|
||||
);
|
||||
}
|
||||
|
||||
const uint32_t fill_y_off = (src_y < copy_src_y) ? 0 : copy_amount;
|
||||
const uint32_t fill_amount = amount - copy_amount;
|
||||
for (uint32_t i = 0; i < fill_amount; i++)
|
||||
for (uint32_t x = 0; x < width(); x++)
|
||||
set_pixel(x, dst_y + fill_y_off + i, fill_color);
|
||||
}
|
||||
|
||||
void Texture::copy_rect(int32_t dst_x, int32_t dst_y, int32_t src_x, int32_t src_y, uint32_t width, uint32_t height, uint32_t fill_color)
|
||||
void Texture::copy_rect(int32_t dst_x, int32_t dst_y, int32_t src_x, int32_t src_y, uint32_t width, uint32_t height)
|
||||
{
|
||||
fill_rect(dst_x, dst_y, width, height, fill_color);
|
||||
|
||||
if (!clamp_to_texture(dst_x, dst_y, width, height))
|
||||
return;
|
||||
if (!clamp_to_texture(src_x, src_y, width, height))
|
||||
|
@ -156,8 +142,8 @@ namespace LibGUI
|
|||
{
|
||||
const uint32_t y_off = copy_dir ? i : height - i - 1;
|
||||
memmove(
|
||||
&m_pixels[(dst_y + y_off) * this->width()],
|
||||
&m_pixels[(src_y + y_off) * this->width()],
|
||||
&m_pixels[(dst_y + y_off) * this->width() + dst_x],
|
||||
&m_pixels[(src_y + y_off) * this->width() + src_x],
|
||||
width * 4
|
||||
);
|
||||
}
|
||||
|
|
|
@ -308,7 +308,8 @@ bool Terminal::read_shell()
|
|||
{
|
||||
const uint32_t scroll = m_cursor.y + newline_count - rows() + 1;
|
||||
m_cursor.y -= scroll;
|
||||
m_window->texture().shift_vertical(-scroll * (int32_t)m_font.height(), m_bg_color);
|
||||
m_window->texture().shift_vertical(-scroll * (int32_t)m_font.height());
|
||||
m_window->texture().fill_rect(0, m_window->height() - scroll * m_font.height(), m_window->width(), scroll * m_font.height(), m_bg_color);
|
||||
should_invalidate = { 0, 0, m_window->width(), m_window->height() };
|
||||
}
|
||||
|
||||
|
@ -540,7 +541,7 @@ Rectangle Terminal::handle_csi(char ch)
|
|||
const uint32_t src_y = m_cursor.y * m_font.height();
|
||||
const uint32_t dst_y = src_y + count * m_font.height();
|
||||
|
||||
texture.copy_horizontal_slice(dst_y, src_y, m_window->height() - dst_y, m_bg_color);
|
||||
texture.copy_horizontal_slice(dst_y, src_y, m_window->height() - dst_y);
|
||||
texture.fill_rect(0, src_y, m_window->width(), count * m_font.height(), m_bg_color);
|
||||
should_invalidate = {
|
||||
0,
|
||||
|
@ -557,7 +558,7 @@ Rectangle Terminal::handle_csi(char ch)
|
|||
const uint32_t dst_y = m_cursor.y * m_font.height();
|
||||
const uint32_t src_y = dst_y + count * m_font.height();
|
||||
|
||||
texture.copy_horizontal_slice(dst_y, src_y, m_window->height() - dst_y, m_bg_color);
|
||||
texture.copy_horizontal_slice(dst_y, src_y, m_window->height() - dst_y);
|
||||
texture.fill_rect(0, m_window->height() - count * m_font.height(), m_window->width(), count * m_font.height(), m_bg_color);
|
||||
should_invalidate = {
|
||||
0,
|
||||
|
@ -575,7 +576,7 @@ Rectangle Terminal::handle_csi(char ch)
|
|||
const uint32_t src_x = m_cursor.x * m_font.width();
|
||||
const uint32_t y = m_cursor.y * m_font.height();
|
||||
|
||||
texture.copy_rect(dst_x, y, src_x, y, m_window->width() - dst_x, m_font.height(), m_bg_color);
|
||||
texture.copy_rect(dst_x, y, src_x, y, m_window->width() - dst_x, m_font.height());
|
||||
texture.fill_rect(src_x, y, count * m_font.width(), m_font.height(), m_bg_color);
|
||||
should_invalidate = {
|
||||
src_x,
|
||||
|
@ -681,7 +682,8 @@ Rectangle Terminal::putcodepoint(uint32_t codepoint)
|
|||
{
|
||||
const uint32_t scroll = m_cursor.y - rows() + 1;
|
||||
m_cursor.y -= scroll;
|
||||
texture.shift_vertical(-scroll * (int32_t)m_font.height(), m_bg_color);
|
||||
texture.shift_vertical(-scroll * (int32_t)m_font.height());
|
||||
texture.fill_rect(0, m_window->width() - scroll * m_font.width(), m_window->width(), scroll * m_font.height(), m_bg_color);
|
||||
should_invalidate = { 0, 0, m_window->width(), m_window->height() };
|
||||
}
|
||||
|
||||
|
@ -708,7 +710,8 @@ Rectangle Terminal::putcodepoint(uint32_t codepoint)
|
|||
{
|
||||
const uint32_t scroll = m_cursor.y - rows() + 1;
|
||||
m_cursor.y -= scroll;
|
||||
texture.shift_vertical(-scroll * (int32_t)m_font.height(), m_bg_color);
|
||||
texture.shift_vertical(-scroll * (int32_t)m_font.height());
|
||||
texture.fill_rect(0, m_window->width() - scroll * m_font.width(), m_window->width(), scroll * m_font.height(), m_bg_color);
|
||||
should_invalidate = { 0, 0, m_window->width(), m_window->height() };
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue