Add Framebuffer.copy_rows_up()

This commit is contained in:
Josh Holtrop 2022-03-23 22:12:38 -04:00
parent b4d8707243
commit c259ae4cee

View File

@ -168,6 +168,20 @@ struct Framebuffer
blend_alpha_bitmap(x, y, alpha_bitmap.ptr, width, height, color); blend_alpha_bitmap(x, y, alpha_bitmap.ptr, width, height, color);
} }
/**
* Copy framebuffer rows up in the framebuffer.
*
* @param y Y coordinate of bottom side of region to copy up.
* @param height Height of region to copy up.
* @param offset Number of rows to copy region up by.
*/
void copy_rows_up(size_t y, size_t height, size_t offset)
{
memcpy32(&m_buffer[buffer_index(0u, y + height + offset - 1u)],
&m_buffer[buffer_index(0u, y + height - 1u)],
(m_stride * height));
}
/** /**
* Scale a color value by an alpha amount. * Scale a color value by an alpha amount.
* *