1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibGL: Implement glReadPixels()

This commit is contained in:
Stephan Unverwerth 2021-05-24 17:52:24 +02:00 committed by Linus Groh
parent d6c84ca4df
commit e54d96d53e
3 changed files with 249 additions and 0 deletions

View file

@ -470,4 +470,22 @@ void SoftwareRasterizer::set_options(const RasterizerOptions& options)
// FIXME: Recreate or reinitialize render threads here when multithreading is being implemented
}
Gfx::RGBA32 SoftwareRasterizer::get_backbuffer_pixel(int x, int y)
{
// FIXME: Reading individual pixels is very slow, rewrite this to transfer whole blocks
if (x < 0 || y < 0 || x >= m_render_target->width() || y >= m_render_target->height())
return 0;
return m_render_target->scanline(y)[x];
}
float SoftwareRasterizer::get_depthbuffer_value(int x, int y)
{
// FIXME: Reading individual pixels is very slow, rewrite this to transfer whole blocks
if (x < 0 || y < 0 || x >= m_render_target->width() || y >= m_render_target->height())
return 1.0f;
return m_depth_buffer->scanline(y)[x];
}
}